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

5- 12
Comments
1 This line defines the sales record, SREC. SREC is described in
detail starting with line 4. There are 32 characters in SREC.
2 This line defines the purchase record, PREC. PREC is described
in detail starting with line 5. There are 35 characters in
PREC.
3 This line defines the transaction record, TREC. TREC is
described in detail starting with line 6. There are 40
characters in TREC.
4 This line names SREC as the first record to be redefined as a
data structure.
5 This line names PREC as the second record to be redefined as a
data structure.
6 This line names TREC as the third record to be redefined as a
data structure.
Using Data Structures to Define Subfields Within a Field
This section tells you how to use data structures to divide a field or
array into subfields. You can then refer to the subfields in Calculation
and Output Specifications. In addition, you can use data structure names
to refer to the subfields as one unit.
Figure 5-8 and Figure 5-9 show how to define subfields two different
ways. Figure 5-8 shows an input area that uses two data structures. The
first data structure, PRODID, defines the subfields in positions 31-40 of
the input TRANS record. The second data structure, CATLOG, is a nested
data structure. That is, it is a data structure defining subfields
within another data structure (in this case, PRODID).
Figure 5-8. Using Data Structures to Define Subfields within a Field