Data Build Manual
Translating Unsupported Data Types
Customizing Data Build
099331 Tandem Computers Incorporated 6–7
Translating
Unsupported Data
Types
You can create your own customized routines to handle unsupported data type
translations. This example will use user exits. See the subsection “User Exits” below
for a description of user exits including limitations.
For this example, the approach is to do the following:
1. Add a holding field in working storage.
2. Perform a user supplied conversion for an input field.
3. Save the results in the holding field in working storage.
4. Move spaces to the input field so that the normal Data Build conversion will not
fail; this is important only if the input data might cause an error in the standard
conversion code.
5. The standard conversion code will process this field and move blanks to the field
in the output record.
6. In a user exit after the field is processed, move the correct value from the holding
field to the field in the output record.
And now for the details:
1. Describe the field in the Source Record Descriptions File as character with the
appropriate length. For example, a 5 digit signed numeric display field with the
sign carried as a separate leading character would be defined as
07 DEM1-ZIPCODE PIC X(6).
2. Complete the BUILD DDL (F2) and GENERATE (F3) steps. The generated
PROCLIB might look something like:
COPY U-IN-DEMO01-DEM1-ZIPCODE OF USERLIB.
ENTER "CONVERT" USING DEM1-ZIPCODE OF IN-DEMO01 1.
MOVE DEM1-ZIPCODE OF IN-DEMO01
TO DEM1-ZIPCODE OF OUT-DEMO01.
COPY U-OUT-DEMO01-DEM1-ZIPCODE OF USERLIB.
3. Modify USERLIB to add user exit code, for example:
?SECTION U-WS
01 DEM1-ZIPCODE-HOLD PIC X(6).
?SECTION U-IN-DEMO01-DEM1-ZIPCODE
CALL "SIGNDNUM" USING DEM1-ZIPCODE OF IN-DEMO01.
* THIS CODE ASSUMES THAT SIGNDNUM REPLACES DEM1-ZIPCODE WITH THE
* CONVERTED VALUE
MOVE DEM1-ZIPCODE OF IN-DEMO01
TO DEM1-ZIPCODE-HOLD.
MOVE SPACES TO DEM1-ZIPCODE OF IN-DEMO01.
?SECTION U-OUT-DEMO01-DEM1-ZIPCODE
MOVE DEM1-ZIPCODE-HOLD
TO DEM1-ZIPCODE OF OUT-DEMO01.