Control statements for Easytrieve processing
If you specify CNTLCARDS EASYTRIEVE, UNLOAD PLUS generates appropriate data definition statements for use with the CA Easytrieve product from CA Technologies.
The following figure displays the EASYTRIEVE process:
UNLOAD PLUS uses the ddname of the unload file data set as the name of the Easytrieve file on the FILE statement.
If you specify a list of unloaded column names with the INTO command option, UNLOAD PLUS uses the list of column names for the Easytrieve file field names in the DEFINE statement. If you do not specify the INTO command option, UNLOAD PLUS uses the column names of the columns from which the data was unloaded. The data types will match the unloaded column types unless they are converted during the unload. For DATE, TIME, and TIMESTAMP columns, the field definition will indicate a character column type of the appropriate length.
In the Easytrieve DEFINE statements, the data format is set to the actual field type and length created in the output record. For character field types, the maximum field length for Easytrieve is 32,767 bytes. If any numeric field sizes exceed the Easytrieve maximums, you must modify the generated control statements in whatever way necessary for Easytrieve to read these columns.
To conform to Easytrieve field naming conventions, UNLOAD PLUS uses the following processing to potentially modify the Db2 column names:
- Because Easytrieve field names are 40 characters in length, the INTO clause field name (or the Db2 column name if INTO is not used) is used as the field name.
- The first position of the field name is checked for the characters A through Z and numbers 0 through 9. If it is not one of these characters, UNLOAD PLUS converts it to 'Z'. In this case, a message is issued to indicate that a field name has changed. If the first character is a Db2 delimiter character such as ' or ' (in other words, the field name is enclosed in SQL escape characters), it is not converted.
Any new constant fields added by UNLOAD PLUS during unload processing are assigned names using the format ZCONSTn, where n is 1 for the first constant field added and is incremented by one for each additional constant field added.
Any NULL columns processed by UNLOAD PLUS during unload processing create a field named NULLn following the nullable field, where n is 1 for the first field created and is incremented by one for each additional field created. If this field contains a '?' character, its associated field is null. Alternatively, you can use the NULLIF option to insert a value when the field is null and thus remove the extra byte.
Easytrieve normally cannot process DB2 VARCHAR fields. To facilitate using these field types, UNLOAD PLUS allows you to specify FIXEDVARCHAR YES, converting these fields to fields of fixed size. When you specify FIXEDVARCHAR YES, UNLOAD PLUS defines a 2-byte count field followed by the fixed-length field.