Specifying data for different field types and attributes
You can use FMTOPT(*MAP) to map data between fixed-length and variable-length fields and between variable-length fields with different maximum lengths.
When mapping a variable-length field with a length of zero to a variable-length to-field, the to-field length is set to zero.
When mapping a variable-length field with a length of zero to a fixed-length to-field, the to-field is filled with single-byte blanks (X'40'), unless the to-field is a DBCS-only field. A DBCS-only to-field is set to X'4040's and surrounded by shift-out and shift-in (SO-SI) characters.
When mapping variable-length fields to variable-length fields and the from-field does not have a length of zero and graphic fields are not being mapped to or from bracketed DBCS fields, the following action happens:
- If the from-field data length is less than or equal to the maximum length of the to-field, the length of a variable-length from-field is copied to a variable-length to-field.
- If the from-field data length is greater than the maximum length of the to-field, the data of the from-field is truncated to the maximum length of the to-field, and the to-field length is set to its maximum length. The data is truncated in a manner that ensures data integrity.
In the examples, x represents a blank, < represents the shift-out character, and > represents the shift-in character. The 2-byte length is actually a binary number shown as a character to make the example readable.
- Mapping variable-length fields to fixed-length fields
You can use FMTOPT(*MAP) to map variable-length fields to fixe-length fields.
- Map fixed-length fields to variable-length fields
You can use FMTOPT(*MAP) to map fixed-length fields to variable-length fields.
- Date, time, and timestamp fields using FMTOPT(*MAP) or FMTOPT(*NOCHK)
You can use FMTOPT(*MAP) or FMTOPT(*NOCHK) for the date, time, and timestamp fields. The copy operation is handled differently according to your settings.
- Null-capable fields using FMTOPT(*MAP) or FMTOPT(*NOCHK)
You can use FMTOPT(*MAP) or FMTOPT(*NOCHK) for null-capable fields. The copy operation is handled differently according to your settings.
- CCSIDs using FMTOPT(*MAP) or FMTOPT(*NOCHK)
You can use FMTOPT(*MAP) or FMTOPT(*NOCHK) for CCSIDs. CCSID conversions are handled differently according to your settings.
- DBCS-graphic fields using FMTOPT(*MAP) or FMTOPT(*NOCHK)
You can use FMTOPT(*MAP) or FMTOPT(*NOCHK) for DBCS-graphic fields. The copy operation is handled differently according to your settings.
Parent topic:
Copying between different database record formats (FMTOPT parameter)