REPLACE supports the following parameters:
Use field-name when referencing a data field that is defined in the record's layout. The use of field-name requires that the record's layout be available to the CA File Master Plus 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.
The position to begin scanning. Valid choices include:
The actual position number.
The relative position to the record's current location.
Amount of data to scan. A scan-length of zero means to scan the entire record starting at the position parameter's value. Valid values are 0 – 32760. If the scan-length is omitted, no scanning is done.
Valid choices include the following:
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
Valid values include the following:
Character—matches specified case
Numeric—processes the literal as defined by the field-name parameter. Define the field-name parameter as a numeric field: it is only valid when a field-name parameter is supplied.
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 use of to-field-name requires that the record's layout be available to the CA File Master Plus 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 include the following:
The actual position number
The relative position to the record's current location
Valid choices include the following:
Character—matches specified case.
Numeric—processes the literal as defined by the field-name parameter. The field-name parameter must be defined as a numeric field, and it is only valid when a field-name parameter is supplied
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. If this parameter is specified, the scan-length parameter must be also supplied.
This example syntax overlays the first Y found in positions 40 thru 59 with the character X.
UPDATE, REPLACE(40,20,EQ,C'Y',C'X')
You can obtain the same results by using the field-name parameter:
UPDATE, LAYOUTFILE(LAYOUT), REPLACE(FIELD-NAME,CO,C'Y',C'X')
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 © 2013 CA.
All rights reserved.
|
|