FIELD (REPLACE SEGMENT)
Use with REPLACE SEGMENT to specify the expression that determines the contents of the field to be included in the segment you are replacing.
You can also change the format of the data when it is added to the output file using TRANSFORM. The changes to the format include the:
- length
- type of data
Follow these guidelines when you specify the FIELD keyword.
- Repeat the FIELD keyword until you have defined the segment.
- Specify the fields in the order that you want them to appear in the output file.
Expressions used with REPLACE SEGMENT can only refer to the current segment (the one named in the REPLACE SEGMENT keyword) or segments higher in the hierarchical path.

Required or Optional | Required if you specify the WITH keyword |
|---|---|
Synonym | None |
Values | This keyword is followed by an option list that contains several keywords as shown in the syntax diagram above Specify the expression that determines the contents of the field that is replaced.
|
Default Value | None |
Example |
|
OUTPUTFILE ( DDNAME( &outdd )
SELECT SEGMENT ( &segname )
REPLACE SEGMENT ( &segname
WITH (
FIELD (
( IF ( &field1 IS &format ) THEN ( &field1 ) ELSE ( &n ) )
TRANSFORM ( s:lt )
)
FIELD ( ( &field2 ) )
)
)
)
)