Conversion rules for copying files

The Table 1 table below shows the field conversions that are allowed between mapped fields in the from-file and to-file record formats. If fields with the same name have incompatible attributes between the from-file and to-file formats, you can only use FMTOPT(*NOCHK) to perform the copy. An X indicates that the conversion is valid, and a blank indicates a field mapping that is not valid.

When mapping character fields, the field being copied is truncated on the right if it is longer than the field into which the copy is made. For example, a character field of length 10 is copied into a character field of length 6; ABCDEFGHIJ becomes ABCDEF. If the field that is being copied is shorter than the field into which it is copied, the field is padded on the right with blanks. For example, a character field of length 10 is copied into a character field of length 12; ABCDEFGHIJ becomes ABCDEFGHIJxx (x = blank).

When you are mapping numeric fields, and the field being copied is longer than the field into which the copy is made, the field being copied is truncated on the left and right of the decimal point. For example, a zoned decimal field of length 9 with 4 decimal positions is copied to a zoned decimal field of length 6 with 3 decimal positions; 00115.1109 becomes 115.110.

If significant digits must be truncated to the left of the decimal point, the value is not copied, and the field is set to its default value (either the parameter value of the DFT keyword, if specified, or zero, if the DFT keyword is not specified). Also, if significance will be lost because a floating-point numeric value exponent is too large, the to-file field is set to its default value.

When you are mapping numeric fields for which the field that is being copied is shorter than the field into which the copy is made, the field being copied is padded with zeros on the left and right of the decimal point. For example, a packed decimal field of length 7 with 5 decimal positions is copied to a packed decimal field of length 10 with 6 decimal positions; 99.99998 becomes 0099.999980.

Table 1. Field conversions. (This table is not applicable to FMTOPT(*CVTFLOAT) or FMTOPT(*NULLFLAGS), where the from-file data is defined by the to-file.)
From field To character, binary character or hexadecimal field To packed decimal field To zoned decimal field To binary (no decimals positions) field To floating point field To binary field (with decimals positions)
Character, binary character or hexadecimal X          
Packed   X X X X  
Zoned   X X X X  
Binary (no decimal positions)   X X X X  
Floating point   X X X X  
Binary (with decimal positions)           X1
Note:
1
A binary numeric field with one or more decimal positions can be copied only to a binary field with the same number of decimal positions.