REPLACE supports the following parameters:
Use field-name when referencing a data field that is defined in the record's layout. The layout must be available to the job step. For more information on how to make the record's layout available, see the keyword LAYOUTFILE.
Note: When this parameter is supplied, the keyword's position, length, decimal-positions, and data type are all retrieved from the field-name definition, and are used to validate the from-data and to-data's formats.
Specifies the position to begin scanning. Valid choices are as follows:
The actual position number.
The relative position to the record's current location.
Specifies the amount of data to scan. A scan-length of 0 means the entire record is scanned, starting at the position parameter's value. Valid values are 0 - 32760. If the scan-length is omitted, no scanning is done.
Specify one of the following values:
Contains—If a field-name is supplied, the position and scan-length values are retrieved from the field-name's defined starting position and physical length. If position and scan-length are supplied, the record is scanned for the data beginning at position for a length of scan-length.
Equal
Not equal
Greater than
Greater than or equal to
Less than or equal to
Less than
Specify one of the following values:
Character—matches specified case
Numeric—processes the literal as defined by the field-name parameter when field-name is defined as a numeric field.
Packed
Text—matches both lower and uppercase alphabetic characters. Alphanumeric characters are permitted.
Hexadecimal
Use to-field-name to update a field other than the field-name's value. The layout must be available to the job step. For more information on how to make the record's layout available, see the keyword LAYOUTFILE.
Note: When this parameter is supplied, the keyword's position, length, decimal-positions, and data type are all retrieved from the to-field-name definition, and are used to validate the to-data.
The starting field position in the record. If to-position and ALL are both supplied, the keyword receives a syntax error. Valid values are as follows:
The actual position number
The relative position to the record's current location
Specify one of the following values:
Character—matches specified case.
Numeric—processes the literal as defined by the field-name parameter when field-name is defined as a numeric field.
Packed
Text—upper case letters are substituted for their lower case counterparts. Alphanumeric data is permitted.
Hexadecimal
Replaces every occurrence in the record within the scan-length. If to-position is also supplied, the command receives a syntax error. When ALL is specified, the scan-length parameter must be also supplied.
This example syntax replaces every occurrence of the letter Y found in positions 40 thru 59 with the letter X.
UPDATE, REPLACE(40,20,EQ,C'Y',C'X',ALL)
You can obtain the same results by using the field-name parameter:
UPDATE, LAYOUTFILE(LAYOUT), REPLACE(FIELD-NAME,CO,C'Y',C'X',ALL)
This example syntax replaces the CUST-MONTH-SALES values with zero in the format as defined by the layout.
UPDATE, LAYOUTFILE(LAYOUT), REPLACE(CUST-MONTH-SALES,N'0')
This example syntax replaces the three bytes at position 95 with XYZ if position 16 of the INFILE does not equal the string ABC.
UPDATE, REPLACE(16,NE,C'ABC',95,C'XYZ')
You can obtain the same results by using the field-name and the to-field-name parameters
UPDATE, LAYOUTFILE(LAYOUT), REPLACE(FIELD-ONE,NE,C'ABC',FIELD-TWO,C'XYZ')
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|