Copy commands support for null values
You can copy files that contain null-capable fields by using the CPYF and CPYFRMQRYF commands. The FMTOPT parameter allows mapping of null-capable fields.
The INCREL parameter allows the selection of records that are based on whether a field is or is not null. While copying the records to the to-file, the following commands ignore null values in the from-file:
The following conditions or values on the CPYF or CPYFRMQRYF command ignore null values in the from-file while copying the records to the to-file:
- CPYTOTAP
- CPYTODKT
- CPYFRMTAP
- CPYFRMDKT
- FMTOPT(*NOCHK)
- FMTOPT(*CVTSRC)
- Device to-file
Record selection involving null values can still be done, but only the user-specified or default value in the buffer (rather than a null value) is copied to the to-file. Null values cannot be preserved in these instances. Any print listings produced when a copy command is run (including TOFILE(*PRINT), PRINT(*COPIED), PRINT(*EXCLUDE), and PRINT(*ERROR)) also ignore null values.
Parent topic:
Copying files: Basic functions
Related information
CPYF command
CPYFRMQRYF command