|
.-,-----------------------------.
| .-,-------. |
V V | |
>>-REFORMAT--FIELDS=--(----+-+-F1:-+--p,m----+-----+-+-+-+--)--->
| '-F2:-' '-p,m-' |
+-?-------------------------+
'-+-F1:-+--p----------------'
'-F2:-'
>--+------------+----------------------------------------------><
'-,FILL=byte-'
A REFORMAT statement can always be used for a JOINKEYS application,
and is required unless a JOIN statement with the ONLY operand is specified.
The REFORMAT statement indicates the fields from the F1 file and/or
the F2 file you want to include in the joined records, and the order
in which you want the fields to appear. You can also include an indicator
of where the key was found in the joined records ('B' for key found
in F1 and F2, '1' for key found in F1 only, or '2' for key found in
F2 only).
If the REFORMAT statement only defines position with length (p,m)
fields, each joined record will be fixed-length (TYPE=F) with a LENGTH
equal to the total length of all of the p,m fields. The maximum length
for TYPE=F joined records is 32760 bytes. The F1 and F2 files can
both be fixed-length, both be variable-length, or can be mixed fixed-length
and variable-length.
If the REFORMAT statement defines a position without a length (p
without m) field, each joined record will be variable-length (TYPE=V)
with a LENGTH equal to the total length of all of the p,m fields plus
the variable length of each p field (one for F1 and/or one for F2).
The maximum length for TYPE=V joined records is 32767 bytes. The
F1 and F2 files can both be variable-length or can be mixed fixed-length
and variable-length. However: - The first field must contain the RDW (1,n with n equal to or greater
than 4) and must be from a variable-length file (F1 or F2).
- The position without length fields (one from the F1 file and/or
one from the F2 file) must be the last fields specified and must be
from a variable-length file (F1 and/or F2).
For joined records created from paired records, any F1 fields specified
will be extracted from the F1 record and any F2 fields specified will
be extracted from the F2 record.
For joined records created from unpaired F1 records, any F1 fields
specified will be extracted from the F1 record and any F2 fields specified
will be filled with the specified FILL character or blanks by default.
However, if the F2 file is variable-length, any specified F2 RDW
fields (1,n with n equal to or less than 4) will be filled with binary
zeros.
For joined records created from unpaired F2 records, any F2 fields
specified will be extracted from the F2 record and any F1 fields specified
will be filled with the specified FILL character or blanks by default.
However, if the F1 file is variable-length, any specified F1 RDW
fields (1,n with n equal to or less than 4) will be filled with binary
zeros.
If a JOIN statement with the ONLY operand is specified, the REFORMAT
statement does not have to be specified. In this case, the layout
of the joined records will depend on the specified JOIN statement
operands as follows: - JOIN UNPAIRED,F1,ONLY
- The joined records will be the original unpaired F1 records.
If the F1 records are fixed-length, the joined records will be fixed-length.
If the F1 records are variable-length, the joined records will be
variable-length.
- JOIN UNPAIRED,F2,ONLY
- The joined records will be the original unpaired F2 records.
If the F2 records are fixed-length, the joined records will be fixed-length.
If the F2 records are variable-length, the joined records will be
variable-length.
- JOIN UNPAIRED,F1,F2,ONLY or JOIN UNPAIRED,ONLY
- The joined records will be variable-length. If the F1 records
are fixed-length, each unpaired F1 record will be variable-length
with an RDW followed by the original F1 record. If the F1 records
are variable-length, each unpaired F1 record will be the original
F1 record. If the F2 records are fixed-length, each unpaired F2 record
will be variable-length with an RDW followed by the original F2 record.
If the F2 records are variable-length, each unpaired F2 record will
be the original F2 record.
In all cases, the TYPE and LENGTH will be set as appropriate for
the joined records.
For joined records with TYPE=F, the maximum LENGTH is 32760.
For joined records with TYPE=V, the maximum LENGTH is 32767. Note
that the RECFM of the output file must be VS or VBS in order to allow
output records greater than 32756.
- FIELDS
.-,-----------------------------.
| .-,-------. |
V V | |
>>-FIELDS=--(----+-+-F1:-+--p,m----+-----+-+-+-+--)------------><
| '-F2:-' '-p,m-' |
+-?-------------------------+
'-+-F1:-+--p----------------'
'-F2:-'
Must be specified to indicate the starting position and
length of each field from the F1 file and/or the F2 file to be included
in the joined records, and optionally an indicator of where the key
was found. The fields and indicator will be included in the joined
records in the order in which they are specified.
- F1:
- indicates the following fields up to the next Fn: or end of
the FIELDS operand are from the F1 file.
- F2:
- indicates the following fields up to the next Fn: or end of
the FIELDS operand are from the F2 file.
- p,m
- specifies the starting position and length of a fixed field.
p specifies the starting position of the field. The first data byte
of a fixed-length record is in position 1. The first data byte of
a variable-length record is in position 5 after the 4-byte RDW. p
can be 1 to 32767. m specifies the length of the field. m can be
1 to 32760. All fields must be completely contained within the first
32767 bytes of the record.
- ?
- indicates a 1-byte indicator is to be included in each joined
record. The indicator will be set to one of the following values
in each paired or unpaired joined record, as appropriate:
- 'B' - the key was found in F1 and F2.
- '1' - the key was found in F1, but not in F2.
- '2' - the key was found in F2, but not in F1.
Only one ? can be specified in the FIELDS operand. If ? is
not the last item, it must be followed by F1: or F2:.
For TYPE=F joined records, the indicator can appear anywhere
in the record. For example, each of the following is valid: * Put indicator in position 1 of each joined record.
REFORMAT FIELDS=(?,F1:1,20,F2:5,8)
* Put indicator in position 21 of each joined record.
REFORMAT FIELDS=(F1:1,20,?,F1:31,9)
* Put indicator in position 25 of each joined record.
REFORMAT FIELDS=(F2:11,20,6,4,?)
For TYPE=V joined records,
the indicator must appear in the fixed part of the record, that is,
after the RDW and before the position without length fields. For
example, the following is valid: * Put indicator in position 5 of each joined record.
REFORMAT FIELDS=(F1:1,4,?,F1:11)
- p
- p without m gives the starting position of a variable field.
Only one p without m field can be specified for F1 and only one p
without m field can be specified for F2.
If either or both p without
m fields are specified, they must be the last fields in the FIELDS
operand. In this case, the first field in the FIELDS operand must
be from a variable-length file (F1 or F2) and must include the RDW
(1,n where n is equal to or greater than 4).
Example
with just p,m fields: REFORMAT FIELDS=(F1:27,5,1,8,F2:19,20,F1:1201,15)
Example with one p without m field: REFORMAT FIELDS=(F1:1,4,F2:6,25,92,2,F1:8,9,32)
Example with two p without m fields: REFORMAT FIELDS=(F2:1,9,21,3,F1:101,7,28,9,122,F2:26)
- FILL
>>-FILL=byte---------------------------------------------------><
The FILL operand can be used to override DFSORT's default
fill byte of a blank (X'40'). The fill byte is used in the following
situations:
- A p,m (fixed) field is specified for a file (F1 or F2) with variable-length
records, and the field extends beyond the end of a record. Each missing
byte is replaced with the fill byte. For example, if a variable-length
F1 record is 20 bytes long and the REFORMAT statement has:
REFORMAT FIELDS=(F1:1,30,41),FILL=C'*'
bytes
21-30 of the joined record are filled with asterisks.
- The REFORMAT statement has a p,m (fixed) field from the F1 file
and a joined record is being created from an unpaired F2 record.
For example if the following are specified:
JOIN UNPAIRED,F2
REFORMAT FIELDS=(F1:21,5,F2:1,10),FILL=X'00'
and an unpaired
F2 record is found, the joined record will have 5 binary zero bytes
followed by bytes 1-10 from the F2 record.
- The REFORMAT statement has a p,m (fixed) field from the F2 file
and a joined record is being created from an unpaired F1 record.
For example if the following are specified:
JOIN UNPAIRED,F1,F2
REFORMAT FIELDS=(F1:21,5,F2:1,10),FILL=X'00'
and an unpaired
F1 record is found, the joined record will have bytes 21-25 of the
F1 record followed by 10 binary zero bytes. (Since UNPAIRED,F1,F2
is specified, if an unpaired F2 record is found, the joined record
will have 5 binary zero bytes followed by bytes 1-10 of the F2 record.)
- byte
- specifies the fill byte. Permissible values are C'x' and X'yy'.
- C'x'
- Character fill byte. x must be one EBCDIC character. If you
want to use an apostrophe as the fill byte, you must specify it as
C''''.
- X'yy'
- Hexadecimal fill byte. yy must be one pair of hexadecimal digits
(00-FF).
|