Usage
The RPLSTRIFS command can be used to replace a string in the input file with another value.
Important as of version 3.1.13: With CASE(*NO), the default value, the search string is evaluated as a regular expression. Characters such as . * + ? ( ) [ ] | then have a special meaning and must be escaped if they are to be searched for literally. Up to version 3.1.12, CASE(*NO) also searched literally. See section “Special characters with CASE(*NO)”.
Parameters and their meaning
The command has the following parameters
|
Parameter |
Element |
Value |
Description |
|---|---|---|---|
|
FRMPATH |
|
|
Name of the input path in the IFS file system. If the command is defined in the i-effect *SERVER *IFS server entry as a *USERDEFINED processing step, the server variable %IFSPATH% can be used. |
|
FRMIFSFILE |
|
|
Name of the input file in the IFS file system without path. If the command is defined in the i-effect *SERVER *IFS server entry as a *USERDEFINED processing step, the server variable %IFSFILE% can be used. |
|
FRMCCSID |
|
|
This parameter is no longer used. The CCSID is read from the attributes of the input file. |
|
CASE |
*YES |
|
The search is case-sensitive. The search string is searched for literally; no character has a special meaning. |
|
|
*NO |
|
Default value. The search is not case-sensitive. The search string is evaluated as a regular expression. Special characters must be escaped with |
|
REPLACE |
|
|
Here you specify which search patterns are replaced with which values in the input file. Up to 50 replacement rules can be defined. They are carried out one after another in the order specified. |
|
|
Element 1 |
|
This element defines the search pattern. With CASE(*YES), it is searched for literally; with CASE(*NO), it is evaluated as a regular expression. |
|
|
|
HEXsearch pattern |
By specifying the string HEX before the actual search pattern, the string to be searched for can be specified in hexadecimal notation. The values refer to the character encoding (CCSID) of the input file, e.g. line end x'0D0A' in an ASCII file (CCSID 1252) and x'0D25' in an EBCDIC file (CCSID 273). A hexadecimal search pattern is also evaluated as a regular expression with CASE(*NO). |
|
|
Element 2 |
|
This element defines the replacement string with which each match of element 1 is replaced. |
|
|
|
HEXstring |
By specifying the string HEX before the actual replacement string, the replacement can be specified in hexadecimal notation, also in the character encoding of the input file.
|
|
|
|
*CRLF |
The string found is replaced with a line break CR LF (x'0D0A' in ASCII, x'0D25' in EBCDIC).
|
|
|
|
*LF |
The string found is replaced with a line feed LF (x'0A' in ASCII, x'25' in EBCDIC).
|
|
|
|
*ADDCRLF |
A line break CR LF is inserted after element 1.
|
|
|
|
*ADDLF |
A line feed LF is inserted after element 1.
With *ADDCRLF and *ADDLF, element 1 itself is inserted, not the text found. Therefore, use these values only with search patterns without special characters, or specify CASE(*YES). |
|
|
|
COMMAND: |
Nothing is replaced. If element 1 is found in the file, the command specified after COMMAND: is run. Element 1 is always searched for literally and case-sensitively, regardless of the CASE parameter. Do not escape special characters here.
|
|
USESEPCHAR |
|
|
This parameter is no longer used and will be removed in a future version. |
|
USEBUFFER |
|
|
This parameter is no longer used and will be removed in a future version. |
Special characters with CASE(*NO)
With CASE(*NO), the following characters have a special meaning in the search pattern. To search for them literally, put a \ in front of them or use CASE(*YES).
|
Character |
Meaning in the regular expression |
Search literally |
|---|---|---|
|
|
any character |
|
|
|
previous character any number of times (including zero) |
|
|
|
previous character at least once |
|
|
|
previous character optional |
|
|
|
start or end |
|
|
|
group |
|
|
|
character set |
|
|
|
number of repetitions |
|
|
|
or |
|
|
|
escape character |
|
Examples of use
|
Description |
Command parameters |
|---|---|
|
Replace the string EANCOM with the string UN in the input file (no special characters, no escaping needed) |
|
|
Replace ST*850 with ST*860. Without escaping, nothing is found with CASE(*NO) because * is evaluated as “any number of times”. |
|
|
Replace the character + with :. Without escaping, the command ends with an error with CASE(*NO). |
|
|
Replace 1.5 with 1,5. Without escaping, the dot matches any character, so also 105 or 1-5. |
|
|
Using a regular expression on purpose: replace several spaces with one |
|
|
Insert a line break after each EDIFACT segment terminator (') |
|
|
Insert a line break after each semicolon, in hexadecimal notation for an ASCII file |
|
|
Remove line breaks from an ASCII file |
|
|
For incoming X12 files, set an environment variable with the mapping ID if ST*850 is in the file. COMMAND: searches literally, so the * is not escaped. The environment variable can then be used in RUNMAP. |
|