Using picture strings and regular expressions with external REXX functions
Picture strings are supported for the search and replace values for functions that perform change processing, and search values for functions that perform contains processing. Regular expressions are supported for search values of functions that perform change and contains processing.
| Function | Regular Expression | Picture String |
|---|---|---|
| CHANGE | Old value | Old and new values |
| CHG_OUT | Old value | Old and new values |
| CHG_VAR | Old value | Old and new values |
| CMP_DATE | Values for contains operators | Values for contains operators |
| CONTAINS | Needle values | Needle values |
| FLD_CO | Needle values | Needle values |
| FLDI | Values for contains operators | Values for contains operators |
| FLDO | Values for contains operators | Values for contains operators |
| TESTC | Values for contains operators | Values for contains operators |
| TFLD | Values for contains operators | Values for contains operators |
- Picture string specification
- The rules for specifying a picture string are described in the CHANGE/CX primary command for picture specification: string1 and string2. These values must be enclosed in alternate quotes. See Examples.
- Regular expression specification
- The rules for specifying a regular expression are described in CHANGE/CX primary command for string1. This value should be enclosed in alternate quotes. See Examples.
Note:
The CCSID value used to interpret the regular expression
is:
- For TSO/ISPF and CICS, the associated terminal CCSID is used.
- For batch, the
‘$$FILEM SET CCSID=nnnnn’value is used when specified. If there is no CCSID statement then the installation option for CCSID is used.
Examples
- Example 1: Uppercase the output record using CHG_OUT with a picture string
-
CHG_OUT("P'<'","P'>'",0) - Example 2: Use a regular expression to remove all ‘,BLKSIZE=number’ from JCL
-
CHG_OUT("RC',BLKSIZE=[0-9]{1,5}'RC","’’",0,,,' ') - Example 3: Search for records that contain ‘Hat’ or ‘Mat’ and ‘Line’ or ‘Lane’ in columns 1 through 60
-
IF FLDI(1,60,,'ACO',"RC'[HM]at'","RC'L[ai]ne'") then OVLY_OUT('Found Hat or Mat and Line or Lane',60) - Example 4: Find records with 7-digit serial numbers ending in 123 or 124
-
IF FLD_CO(,,,”p'SN####123'”,”p'SN####124'”) Then Return 'PROCESS'