The format service uses the format pattern to locate information
and position it in the output buffer. A format pattern consists of
four to seven fields. One field indicates how the format service
should process the pattern. Three fields describe the position, length,
and address of a label. Three fields describe the position, length,
and the address of a data item.
If a series of format patterns are set up by your routine, the
patterns that describe one line must be contiguous and have as a last
entry a fullword of binary zeros.
The second and subsequent data and label addresses in a series
are optional.
If these fields are not provided, the service uses the last address
plus the length to locate a data item or label. To keep track of
updated addresses, the format service uses the twelfth and thirteenth
words in the exit parameter list to store label and data pointers.
See Figure 1 for information about
defining fields in a format pattern.
Figure 1. Format Pattern Description
and Format Pattern Extension 0 1 2 3
┌────────────┬──────────────┬──────────────────┬───────────────────┐
│ Code byte │ Label/Data │ Label relative │ Data relative │
│ │ Length-1 │ address │ address │
├────────────┴──────────────┴──────────────────┴───────────────────┤
│ Format Pattern Extension - Pointer to Label │
4 ├──────────────────────────────────────────────────────────────────│
│ Format Pattern Extension - Pointer to Data │
8 └──────────────────────────────────────────────────────────────────┘
- Code byte
- A 1-byte field that identifies the contents of a pattern. The
settings are:
Bit |
Meaning |
---|
0-1 |
Reserved. |
2 |
Data is not to be converted to printable hexadecimal. |
3 |
Data is in the caller's storage (not in the dump). |
4 |
Data pointer follows (bit 5 must also be on). Either a dump
address or a storage address. (See bit 3) |
5 |
Data is to be placed in buffer. |
6 |
Label pointer follows (bit 7 must also be on). |
7 |
Label is to be placed in buffer. |
If you do not set bits 4 and/or 6, then you should omit
the label pointer and/or data pointer field(s) of the format pattern
extension. Table 1 shows the relationship
between the bit settings of the code byte and the length and contents
of the format pattern extension.
- Label/Data Length-1
- a one byte field that contains two length counts. The first four
bits are the label length minus one. The last four bits are the data
length minus one. This field is used to update label/data addresses
in the parameter list if addresses are not in a pattern.
- Label relative address
- a one-byte field that indicates the position of labels in the
buffer. Specify 0 as the relative address to indicate the first character
of the buffer.
- Data relative address
- a one-byte field that indicates the position of data in the buffer.
Specify 0 as the relative address to indicate the first character
of the buffer.
- Format Pattern Extension
- an optional 8-byte field that contains one of the following:
- A label pointer
- A data pointer
- Both a label pointer and a data pointer
- Neither a label pointer nor a data pointer.
Bits 4 and 6 of the code byte determine the length and contents
of the format pattern extension.
Table 1 shows
the values for bits 4 and 6 of the code byte, and the resultant format
pattern extension.
Table 1. Format Pattern Extension and Code ByteBit 4 of Code Byte |
Bite 6 of Code Byte |
Length of Format Pattern Extension |
Contents of Format Pattern Extension |
---|
0 |
1 |
4 bytes |
Label pointer |
1 |
0 |
4 bytes |
Data pointer |
1 |
1 |
8 bytes |
Label pointer and data pointer |
0 |
0 |
0 bytes |
Format pattern extension does not exist |
A label pointer contains the address of a character
string that you want the format service to use for labels. When you
include a label pointer in the pattern, you must set bits 6 and 7
of the code byte. When you do not specify a label pointer, the format
service updates the label address in the exit parameter list and uses
it.
A data pointer contains the address of the first
byte of data that you want the format service to place in the output
line. When this data is not in the caller's storage, you must set
bit 3 of the code byte to zero; this causes the format service to
use the storage access service to obtain the data. When you include
a data pointer in the pattern, you must set bits 4 and 5 of the code
byte. When you do not specify a data pointer, the format service updates
the data address in the exit parameter list and uses it. If bit 2
is zero, the format service converts this data to printable hexadecimal.
Figure 2 shows sample format patterns.
Figure 2. Sample
Format Patterns* THIS CHARACTER STRING DEFINES LABELS TO BE USED BY THE SERVICE
* FOR THE FORMATTED UCBs
*
TAPELB DC C'FSCTFSEQVOLISTABDMCT' UCB LABELS
* THE FOLLOWING FIVE FORMAT PATTERNS DESCRIBE THE FIRST OF THE
* TWO LINES FOR A TAPE UNIT CONTROL BLOCK (UCB). THE FIRST TWO
* PATTERNS ARE EXPLAINED FOR EACH FIELD.
* THIS PATTERN IDENTIFIES A LABEL AND DATA ITEM THAT WILL BE
* INSERTED IN THE FIRST LINE OF A TAPE UCB
TAPEL1 DS 0F THIS PATTERN SETS UP THE FSCT FIELD
DC X'2F' THIS CODE BYTE IS SET FOR: NO CONVERSION,
* DATA AND LABEL POINTERS FOLLOWING, AND LABEL
* AND DATA ITEM TO BE PLACED IN BUFFER.
DC X'31' LABEL LENGTH-1 IS 3. DATA LENGTH-1 IS 1
DC FL1'12' LABEL RELATIVE ADDRESS IN OUTPUT LINE IS 12
DC FL1'17' DATA RELATIVE ADDRESS IN OUTPUT LINE IS 17
DC A(TAPELB) POINTER TO STRING OF LABELS
DATADDR DC A(0) ADDR OF DATA TO BE FILLED IN DURING EXECUTION
*
* NEXT PATTERN SETS THE FSEQ FIELD IN THE OUTPUT LINE. THIS
* PATTERN USES THE SAME LABEL STRING AND DATA ADDRESS. THE
* FORMAT SERVICE UPDATES ITS LABEL AND DATA ADDRESSES USING
* LENGTH FIELDS. TWO WORDS IN THE EXIT PARAMETER LIST STORE THE UPDATED
* ADDRESSES.
*
DC X'25' CODE BYTE SET FOR: NO CONVERSION, PLACE
* LABEL AND DATA IN BUFFER(NO ADDRESSES-DO UPDATE
DC X'31' LABEL LENGTH(4)-1 IS 3. DATA LENGTH(2)-1 IS 1.
DC FL1'28' LABEL RELATIVE ADDRESS IN OUTPUT BUFFER IS 28.
DC FL1'33' DATA RELATIVE ADDRESS IN OUTPUT LINE IS 33.
*
* THE REMAINING PATTERNS IN THIS LINE ARE CONDENSED
*
DC X'25',X'35',FL1'44',FL1'49' VOLI FIELD
DC X'25',X'30',FL1'59',FL1'64' STAB FIELD
DC X'25',X'30',FL1'76',FL1'81' DMCT FIELD
DC X'00',X'00',FL1'0',FL1'0' INDICATES END
* OF LINE
* THE SECOND LINE OF THE TAPE UCB IS DEFINED BY A SECOND SERIES OF
* FORMAT PATTERNS, TAPEL2.