Data Build Manual

Customizing SQL-LOAD Output
Customizing Data Build
6–18 099331 Tandem Computers Incorporated
2. Run the following outside of Data Build to update the DDL dictionary:
DDL /IN ZZDDLIN, OUT $S.#DDLNEW/
Check the spooler location #DDLNEW and correct any errors.
3. In Data Build, run the GENERATE (F3) step and then modify USERLIB to add
user exit code, for example:
?SECTION U-WS
01 columname-LEN PIC S9(4).
?SECTION U-IN-filename-columname
* This exit code is executed before the generated conversion code has
* processed this field.
* Save the length of the column in working storage
MOVE column length TO columname-LEN.
?SECTION U-OUT-filename-columname
* This exit code is executed after the generated conversion code has
* completed processing this field.
* The generated conversion code moved the full column width from
* (columname OF IN-filename) in the input record to (columname OF
* OUT-filename) in the output record which destroys the LEN field in
* the group. The next statements move the length into the LEN field
* and the full column width from (columname OF IN-filename) in the
* input record to the VAL field in the group. It is OK to move the
* full column width; the LEN field will determine how much data is
* loaded in the NSSQL table.
MOVE columname-LEN TO LEN OF columname OF OUT-filename.
MOVE columname OF IN-filename TO VAL OF columname OF OUT-filename.
4. Run the CREATE (F4) step to create the COBOL85 conversion program with the
user exit code included.
Example of Handling SQL VARCHAR Data
As previously noted, SQL VARCHAR data is loaded at full column width. The
following is an example of a Data Build user modification that will cause SQL-LOAD
or SQL-INSERT to load VARCHAR data at a specified column width. These changes
follow the technique described in section “Handling SQL VARCHAR Data.”
The game plan for this example is to:
Use the first file of the Data Build sample data.
Modify the NSSQL TABLE definition to define DEM1_NAME as VARCHAR.
Add code to USERLIB to set the column length of DEM1-NAME to 3 for the first
record, 0 for the second record, and full column width of 25 for the remaining
records.