HP RPG/XL Programmer's Guide (30318-90001)

5- 14
defined in the data structure starting on line 2. PRODID
occupies positions 31-40 of the input record.
2 This line starts the data structure, PRODID. It describes the
subfields of PRODID in the input record.
3 This line defines the field, CATLOG, that occupies positions 1
and 2 of the field PRODID. Notice that the next two fields are
subfields of CATLOG.
4 This lines defines the field, CLASS, that occupies position 1 of
the field PRODID.
5 This line defines the field, REFNO, that occupies position 2 of
the field PRODID.
Using Data Structures to Reorganize Fields in an Input Record
This section explains how data structures can be used to rearrange input
record fields so that you can use them more readily in a program.
Two examples are presented. The first shows how to reorder one field and
the second shows how to reorganize several fields at once.
Figure 5-10 shows how to reorder the field, KEY05, so that it is the
second part of a key field. The key field will be used for reading a
KSAM file. This example initializes the data structure field, ALPHA, to
A at line 5. When the TRANS file is READ, KEY05 is automatically moved
to the input field and to the data structure. Line 6 shows the KSAM disc
read operation that uses the new key, KEY06.
Figure 5-10. Using a Data Structure to Build a Key Field
Comments