Control statements for SAS processing


If you specify CNTLCARDS SAS, UNLOAD PLUS generates appropriate external file INPUT statements for the SAS product.

These statements can be used to read the unloaded sequential file for processing by SAS to produce reports or for other purposes.

The following figure displays the SAS process:


SAS_option.png

If you specify a list of unloaded column names for the INTO command option, UNLOAD PLUS uses the list of column names for the SAS field description names. If you do not specify the INTO command option, UNLOAD PLUS uses the column names of the columns from which the data were unloaded. The data types will match the unloaded column types unless they are converted during the unload. In the case of DATE, TIME or TIMESTAMP columns, the field definition will indicate a character column type of the appropriate length.

If your Db2 column widths are unloaded into fields that exceed the 200-byte SAS maximum, you must modify the control statements generated by UNLOAD PLUS in whatever way necessary to read these fields. If a Db2 column size exceeds the 200-byte SAS maximum, the sequential file field size generated on the SAS statement will be the large field size, and a warning comment is generated on that statement.

In order to conform to SAS naming conventions, UNLOAD PLUS uses the following processing for each column name unloaded:

  1. SAS names are limited to 8 characters. When generating control statements for processing by SAS, UNLOAD PLUS does not truncate column names or the Db2 column name, but UNLOAD PLUS does issue a warning message.

    Important

    You must check for names that exceed the SAS limit of 8 characters, and correct them if necessary before executing SAS.

  2. The first character of the name is checked for the character '_' and the characters A through Z. If it is not one of these characters, UNLOAD PLUS converts it to '_'. 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.
  3. The remaining characters of the name are checked for the characters A through Z, the numbers 0 through 9, or the special character '_'. UNLOAD PLUS converts any character that is not one of these characters to '_'. If the first character is a Db2 delimiter character, the remainder of the name is not checked for invalid characters.

Variable character fields are assigned a count field name of VARLEN n, where n is incremented for each usage as shown in the following example:

VARLEN1 IB2. @;           /* LENGTH OF FIELD SVARCHAR */
IF VARLEN1'¬= 0 THEN INPUT
SVARCHAR $VARYING16. VARLEN1 @;
INPUT                     /* RESUME INPUT */

Any new constant fields added by UNLOAD PLUS during unload processing are assigned names using the format $CONSTn, where n is 1 for the first field created and is incremented by one for each additional field created.

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 question mark (?) 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.


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*