To process the contents of an output buffer, consider using these
guidelines:
- Base the XSF_OUTBUF definition in macro EDGXSF as shown in Figure 1 on the address of the output buffer you
are interested in.
Figure 1. Output buffer definitionXSF_OUTBUF DSECT Output Buffer
XSF_OUTBUF_BUFLNG DS 1FL4 Buffer Length
XSF_OUTBUF_RQDLNG DS 1FL4 Required Buffer Length
XSF_OUTBUF_DATALNG DS 1FL4 Length of Output Data
XSF_OUTBUF_FIELDS DS 0C Start of Structured Fields
- Base the XSF_SFI definition in macro EDGXSF as shown in Figure 2 on the address of XSF_OUTBUF_FIELDS.
Figure 2. SFI definitionXSF_SFI DSECT Structured Field Introducers
XSF_SFI_LENGTH DS 1FL2 Length
XSF_SFI_ID DS 1CL0003 ID (identifier)
ORG XSF_SFI_ID
XSF_SFI_IDVAL DS 1CL0002 ID (Identifier Value)
XSF_SFI_IDQUAL DS 1CL0001 ID (Identifier Qualifier)
XSF_SFI_TYPE DS 1FL1 Type
DS 1CL0001 Reserved
XSF_SFI_DTYPE DS 1FL1 Data type
XSF_SFI_LEN EQU *-XSF_SFI
XSF_SFI_DATA DS 0C Start of Data
Note: XSF_SFI_DATA can contain compound data with an internal structure
of:
XSF_SFI_CompType
XSF_SFI_LEN1
XSF_SFI_DTYPE1
XSF_SFI_Factor
XSF_SFI_LEN2
XSF_SFI_DTYPE2
XSF_SFI_Value
- Find the type of structured field you are processing by using
the two-byte structured field identifier at XSF_SFI_IDVAL. The values
of XSF_SFI_IDQUAL for ADL, address line SFI, and UID, User ID SFI,
described in Structured field introducers (SFIs) are not constant
values.
- Move to the next structured field by adding the length at XSF_SFI_LENGTH
to the XSF_SFI pointer.
- Verify that you have reached the end of the valid data in the
output buffer by using the length of the output data at XSF_OUTBUF_DATALNG.
- Determine the type of data you are processing, by using the value
in XSF_SFI_DTYPE.
- Obtain the length of the data that starts at XSF_SFI_DATA, by
subtracting XSF_SFI_LEN from the structured field length at XSF_SFI_LENGTH.
in the output buffer.
- Move to the end of the SFI by adjusting the pointer. In this example,
when your pointer is at offset x'00000071' into the output buffer,
there are two indicators that you are done with the contents of the
buffer:
- Repeat these steps to process each structured field.
In the examples shown in
Figure 1 and
Figure 2:
- Adding the length of the data (x'00000071') at XSF_OUTBUF_DATALNG
to the address of XSF_OUTBUF_DATALNG results in the address just beyond
the last byte of data in the output buffer. You might find this a
useful double-check to ensure that you are looking at valid data.
- Your XSF_SFI pointer is at the first structured field in the output
buffer (offset 000C in the buffer), and the SFI identifier value at
XSF_SFI_IDVAL (0260) tells you that the SFI is a Begin DATASET group.
To move to the next structured field, add XSF_SFI_LENGTH (0008) to
your pointer.
- Your XSF_SFI pointer is now at the second structured field in
the output buffer (offset 0014 in the buffer); XSF_SFI_IDVAL (82A0)
identifies the SFI as DSN (Data Set Name); and XSF_SFI_LENGTH (001B)
minus XSF_SFI_LEN (8) gives you a length of 19 bytes for the data
set name. The type of data is variable-length character because the
data type at XSF_SFI_DTYPE equals XSF_SFI_DTYPE_CHAR_VAR.
One
method to process structured field introducers is to use an SFI lookup
table containing ID values and addresses of corresponding processing
routines. Another method is to use the XSF_SFI_DTYPE: Call an appropriate
data-type routine with the address of the SFI or SFI data and the
address of an output area as inputs.
After you finish processing
this structured field, update the XSF_SFI pointer to the next structured
field.