Keywords
Specify keywords after the command to further control processes, like record selection, data manipulation, and report outputs. Keywords immediately follow the command and are processed in the order specified. Specify certain keywords only once, while you can specify other keywords multiple times.
fmplus11
Specify keywords after the command to further control processes, like record selection, data manipulation, and report outputs. Keywords immediately follow the command and are processed in the order specified. Specify certain keywords only once, while you can specify other keywords multiple times.
2
Data Specification
The data specification rules for the parameters
from-data
, to-data
, and data
are described in this section.- Duplication factorSpecifies the number of times the following data is to be repeated. Specify a value from 1 through 32,760 that is less than the record's length. This value precedes thefrom-data,to-data,anddataportion of the data specification.
- Data, from-data, and to-data
- C'c…'Character -- matches specified case
- N'n…'Numeric
- N'+n…'andN'-n...'Signed numeric
- P'n…'Positive packed decimal
- P'+n…'andP'-n...'Signed packed decimal
- T'c…'Text -- matches both lowercase and uppercase alphabetic characters. Alphanumeric data is permitted.
- X'hh…'Hexadecimal
- Character data within quotes is always treated as text.
- When the text contains an apostrophe, enclose the text in quotes.
- When the text contains a quote, enclose the text in apostrophes.
Examples
Scan the data from position 132 to the end of the record looking for the character string, or data value, "JAN,FEB,MAR".
SELRECIF(132,0,EQ,C"JAN,FEB,MAR")
Scan the data from position 132 to the end of the record looking for any of the character strings, or data value of, 'JAN' or 'FEB' or 'MAR'.
SELRECIF(132,0,EQ,C'JAN,FEB,MAR')
The next example changes all instances of 'SHR' and 'MOD' to '(NEW,CATLG,DELETE)'
CHANGE(1,0,EQ,C'SHR,MOD',C"(NEW,CATLG,DELETE)",ALL)
Position Specification
The position specification rules are as follows:
- Actual position0 - 32760, where 0 signifies all record positions and 1 - 32760 is the actual position in the input or output record in which the keyword is operating.You cannot reference an actual position that is greater than the defined maximum record length.
- Relative position-nnn or +nnnThe following two separate relative positions exist: thescan relative position, and themove relative position. Both relative positions are maintained separately and are either added to (+) or subtracted from (-) when ascan-lengthis specified or a MOVE action is performed.Thescan relative positionreferences the input record, and is set to position 1 after each record READ. Thescan relative positionremains at position 1 until an IF, AND, OR, SELMEMIF, SELRECIF, SKIPRECIF, ACCUM, CHANGE, EDIT, MOVE, or REPLACE keyword specifically selects a position using thescan-lengthparameter. When that happens, thescan relative positionresets to the leftmost byte of the data selected by the scan. If thescan-lengthparameter is the same size of thedataorfrom-datavalue, no scanning is done and thescan relative positionremains unchanged.Themove relative positionreferences the move output record buffer and is set to record position 1 after the first input record is read and after each WRITE. Themove relative positionremains at position 1 until a MOVE action is performed. When a MOVE action is performed the newmove relative positionis computed by adding the currentmove relative positionto theto-positionrelative value plus thelengthvalue. If theto-positionis an actual position and not a relative position, the newmove relative positionis the actual position.You cannot use relative positioning to select an input record location or move output record location that computes to less than 1 or greater than the defined maximum record length for the file.
Field Name Support
In addition to requesting a certain position within a record, many keywords can reference a particular field by its name. The field name must be defined in the record layout, which must be available by using the LAYOUTFILE keyword or through the default ddname LAYOUT. Referencing the field name makes it easier when selecting or manipulating the record data.
If the keyword specifies a value to compare to the field name that is less than the character or text, the value is left justified and padded with spaces. All numeric compare values are right justified and filled with leading zeros. If the length of the compare field is shorter than the
field-name
length, the compare value is padded to the field-name length. If the compare value is defined asfield-name
, we recommend that you use a data type that matches the field-name
. If the compare uses the contains operator (CO), no padding takes place.This example locates all records that have a CUST-TOTAL-MNTHLY-PYMNTS field whose value is greater than 1000. (By using the N, numeric, data-type, you do not have to know how the field is defined. CA File Master Plus makes the correct selections.)
SELRECIF(CUST-TOTAL-MNTHLY-PYMNTS,GT,N'1000')
The next example changes all records whose CUST-ID field value is C'ABC ' from C'ABC ' to C'9ABC ':
CHANGE(CUST-ID,EQ,C'ABC',C'9ABC')
You may reference specific indexed fields, those fields defined by the OCCURS clause, by supplying the field indexed value. For example, the following example references the CUST-MONTHLY-PYMT third occurrence:
CHANGE(CUST-MONTHLY-PYMT(3),GT,N'50.00')
Abbreviated Keywords
Abbreviated keywords are shortened versions of the keyword. The following list shows each keyword followed by its shortest abbreviation.
- ACCUM - ACC
- ADDCNTL - ADDCNTL
- CHANGE - CHA
- CHANGED - CHANGED
- COMPDIFF - COMPD, CD
- COMPRC - COMPRC
- COMPREPORT - COMPRE, CR
- CSECT - CSECT
- CSECTCOMPARE - CSECTC
- CSECTEXCLUDE - CSECTEXCL
- CSECTINCLUDE - CSECTINCL
- DELETED - DELETED
- DIRECTION - DIR
- DIRREPORT - DIRREP
- DSN - DSN
- EDIT - ED
- EMPTYRC - EMPTYRC
- FIELDDISPLAY - FIELDD, FD
- FORMAT - FOR
- GENERATION - GEN
- IF, AND, OR - IF, AND, OR
- INFILE - INFI
- INFORMAT - INFO
- INLIM - INL
- INSERTED - INSERTED
- INTERVAL - INT
- LAYOUTFILE - LAYOUTF, LF
- LAYOUTFILEN - LAYOUTFILEN
- LAYOUTRC - LAYOUTRC
- LINEPAGE - LINEP
- LOAD - LOAD
- LOADEXCLUDE - LOADEXCL
- LOADINCLUDE - LOADINCL
- LOADLIB - LOADLIB
- LOGFILE - LOGF
- MAP - MAP
- MATCHED - MATCHED
- MEMBER - MEM
- MOVE - MOV
- NEWFILE - NEWF
- NEWMEMBER - NEWM
- NEWRID - NEWR
- NEXTREC - NEXTR
- NOSELRC - NOSELRC
- OLDFILE - OLDF
- OLDRID - OLDR
- OUTFILE - OUTF
- OUTLIM - OUTL
- PADCHAR - PAD
- PDSSTATS - PDS
- POSITION - POS
- PRINTLIM - PRINTL
- PRINTREC - PRINTR
- PROGRAM - PROG
- PROPERTIESINCLUDE - PROPERTIESIN, PROPINCL
- PROPINCL - PROPIN
- PROPERTIESEXCLUDE - PROPERTIESEX, PROPEXCL
- PROPEXCL - PROPEX
- RDW - RDW
- REFFILE - REFF
- REPLACE - REP
- REPLACEKEY - RK
- REPLACEMEM - RM
- RID - RID
- SELECT - SELE
- SELLIM - SELL*
- SELMEMIF, AND, OR - SELM
- SELRECIF, AND, OR - SELR
- SETRC - SETRC
- SKIP - SKIP
- SKIPRECIF - SKIPR
- STOP - STOP
- SYNCKEY - SYNCK
- SYNCLIM - SYNCL
- TRUNCRC - TRUNCRC
- UNIT - UNIT
- VOLSER - VOL
- WRITE - WR