|
The FD statement defines the contents and length of a field that
will be used subsequently by a CREATE statement (or statements) to
form output records. A defined field within the input logical record
may be selected for use in the output records if it is referred to,
by name, by a subsequent CREATE statement.
Figure 1 shows how the FD statement is used to specify
a field in an input record to be used in output records. The left-hand
side of the figure shows that a field in the input record beginning
at byte 50 is selected for use in the output record. The right-hand
side of the figure shows that the field is to be placed at byte 20
in the output record.
Figure 1. Field Selected from the
Input Record for Use in the Output Record
When selecting fields from an input record (FD INPUT=ddname),
the field must be defined by an FD statement within each set of utility
control statements. In that case, defined fields for field selection
are not usable across sets of utility control statements; such an
FD record may be duplicated and used in more than one set of utility
control statements within the job step.
You can also indicate that a numeric field is to be modified after
it has been referred to n times by a CREATE statement or
statements, that is, after n cycles, a modification is to
be made. A modification will add a number you supply to a field.
The syntax of the FD statement is:
Label |
Statement |
Parameters |
---|
[label]
|
FD
|
NAME=name ,LENGTH=length [,STARTLOC=starting-location] [,FILL={'character|X'nn'}] [,{FORMAT=pattern[,CHARACTER= character]| PICTURE=length,{' character-string'|P
'n'|B }}] [,SIGN=sign] [,ACTION={ FX|RO|RP|SL|SR|TL|TR|WV} [,INDEX=n [,CYCLE n][,RANGE= n]] [,INPUT=ddname] [,FROMLOC=number]
|
where:
- NAME=name
- specifies the name of the field defined by this FD statement.
- LENGTH=length
- specifies the length, in bytes, of the defined field. For variable
records, the sum of the field must be four less than the maximum record
length. This is to account for the four-byte record descriptor word.
If
the INPUT parameter is specified, the LENGTH parameter overrides the
length of each input logical record. If the combination of FROMLOC
and LENGTH values is longer than the input record, the result is unpredictable.
For ACTION=RP or WV, the length is limited to 16383 bytes.
For ACTION=RO, the length is limited to 10922 bytes.
- STARTLOC=starting-location
- specifies a starting location (within all output records using
this field) in which a field is to begin. For example, if the first
byte of an output record is chosen as the starting location, the keyword
is coded STARTLOC=1; if the tenth byte is chosen, STARTLOC=10 is coded.
Default: The field will begin in the first available
byte of the output record (determined by the order of specified field
names in the applicable CREATE statement). For variable records, the
starting location is the first byte after the length descriptor.
- FILL={'character'|X 'nn'}
- specifies a value that is to be placed in each byte of the field
in the output record before any other operation in the construction
of the field.
These values can be coded:
- 'character'
- specifies a character that is to be converted to EBCDIC and
placed in each byte of the output field.
- X'nn'
- specifies 2 hexadecimal digits (for example, FILL=X'40',
or FILL=X'FF') to be placed in each byte of the output field.
Default: Binary zeros are placed
in the output field.
- FORMAT=pattern[,CHARACTER=character]
- specifies an IBM-supplied pattern that is to be placed in the
defined field. FORMAT must not be used when PICTURE is used. The values
that can be coded are:
- pattern
- specifies the IBM-supplied patterns, as follows:
- AL
- specifies an alphabetic pattern.
- AN
- specifies an alphanumeric pattern.
- BI
- specifies a binary pattern.
- CO
- specifies a collating sequence pattern.
- PD
- specifies a packed decimal pattern.
- RA
- specifies a random binary pattern.
- ZD
- specifies a zoned decimal pattern.
- CHARACTER=character
- specifies the starting character of a field.
- PICTURE=length,{ 'character-string'|P'n'|B'n'}
- specifies the length and the contents of a user-supplied pattern.
PICTURE must not be used when FORMAT is used. If both PICTURE and
NAME are omitted, the fill character specified in the CREATE statement
appears in each byte of applicable output records. These values can
be coded:
- length
- specifies the number of bytes that the pattern will occupy. Length must be equal to or less than the LENGTH parameter value in
the FD statement.
- 'character-string'
- specifies a character string that is to be converted to EBCDIC
and placed in the applicable records. The character string is left-aligned
at the defined starting position. A character string may be broken
in column 71, if you place a nonblank character in column 72 and continue
the string in column 4 of the next statement. The number of characters
within the quotation marks must equal the number specified in the length subparameter.
- P'n'
- specifies a decimal number that is to be converted to packed
decimal and right-aligned (within the boundaries of the defined length
and starting byte) in the output records or defined field. The number
of characters within the quotation marks must equal the number specified
in the length subparameter.
- B'n'
- specifies a decimal number that is to be converted to binary
and right-aligned (within the boundaries of the defined length and
starting byte) in the output records or defined field. The number
of characters within the quotation marks must equal the number specified
in the length subparameter.
- SIGN=sign
- specifies a mathematical sign (+ or -), to be used when
defining a packed decimal or binary field.
Default: Positive
(+).
- ACTION={FX|RO|RP|SL|SR|TL|TR|WV}
- specifies how the contents of a defined field are to be altered
(if at all) after the field's inclusion in an output record.
.
These values can be coded:
- FX
- specifies that the contents of a defined field are to remain
fixed after the field's inclusion in an output record.
FX is the
default.
- RO
- specifies that the contents of a defined field are to be rolled
after the field's inclusion in an output record. The pattern ("picture")
is moved to the left by one byte for each output record, until the
first nonblank character of the picture is in the first byte of the
field. Then, the picture is moved to the right one byte for each output
record, until it returns to its original position in the field.
RO
can be used only for a user-defined pattern. For RO to be effective,
the picture length must be less than the field length.
- RP
- specifies that the contents of a defined field are to be rippled
after the field's inclusion in an output record.
- SL
- specifies that the contents of a defined field are to be shifted
left after the field's inclusion in an output record.
- SR
- specifies that the contents of a defined field are to be shifted
right after the field's inclusion in an output record.
- TL
- specifies that the contents of a defined field are to be truncated
left after the field's inclusion in an output record.
- TR
- specifies that the contents of a defined field are to be truncated
right after the field's inclusion in an output record.
- WV
- specifies that the contents of a defined field are to be waved
after the field's inclusion in an output record. The pattern ("picture")
is moved to the left by one byte for each output record, until the
first nonblank character of the picture is in the first byte of the
field. Then the character string is reset to its original position.
WV
can be used only for a user-defined pattern. For WV to be effective,
the picture length must be less than the field length.
- INDEX=n[,CYCLE=n] [,RANGE=n]
- specifies a decimal number to be added to this field whenever
a specified number of records have been written. INDEX is valid only
with FORMAT patterns ZD, PD and BI, or PICTURE patterns P'n'
and n .
Additional values can be coded:
- CYCLE=n
- specifies a number of output records (to be written as output
or made available to an exit routine) that are treated as a group
by the INDEX keyword. Whenever this field has been used in the construction
of the specified number of records, it is modified as specified in
the INDEX parameter. For example, if CYCLE=3 is coded, output records
may appear as 111 222 333 444, and so forth. This parameter can be
coded only when INDEX is coded.
- RANGE=n
- specifies an absolute value which the contents of this field
can never exceed. If an index operation tries to exceed the specified
absolute value, the contents of the field as of the previous index
operation are used.
Default: No indexing is performed.
If CYCLE is omitted and INDEX is coded, a CYCLE value of 1 is assumed;
that is, the field is indexed after each inclusion in a potential
output record.
- INPUT=ddname
- specifies the ddname of a DD statement defining a data set used
as input for field selection. Only a portion of the record described
by the FD statement will be placed in the output record. If the record
format of the output data set indicates variable-length records, the
position within the output record will depend upon where the last
insertion into the output record was made unless STARTLOC is specified.
The ddname SYSIN must not be coded in the INPUT parameter on the FD
control statement. Each ddname should not appear more than once on
any control statement.
A corresponding ddname must also be
specified in the associated CREATE statement in order to have the
input records read.
- FROMLOC=number
- specifies the location of the selected field within the input
logical record. The number represents the position in the input record.
If, for example, FROMLOC=10 is coded, the specified field begins at
the tenth byte; if FROMLOC=1 is coded, the specified field begins
at the first byte. (For variable-length records, significant data
begins in the first byte after the 4-byte length descriptor.)
When
retrieving data sets with fixed or fixed-blocked record formats and
RKP>0, the record consists of the key plus the data with embedded
key. To copy the entire record, the output logical record length has
to be the input logical record length plus the key length. If only
the data (which includes the embedded key) is to be copied, set FROMLOC
equal to the keylength.
Default: The
start of the input record.
Related reading:
- For information about starting characters, see IBM-Supplied Patterns .
- For information about system actions compatible with FORMAT and
PICTURE values, see Table 1.
- For examples of IEBDG ACTION patterns, see Figure 1.
|