IF (AND)
The IF parameter selects specific records to be processed by the function being executed. AND is a synonym of IF; AND can be used after the inclusion of at least one IF parameter (see AND ). The maximum number of IF parameters that can be entered is limited by the value of the MAXENT parameter (see MAXENT-ME).
IF has three syntax forms based on three record selection criteria:
Record Selection by Data Content:
{operator} {oper2}
Record Selection by Valid Numeric or Packed Data:
IF=(location,length,[dupl] operator-data-type)
Record Selection by Timestamp:
IF=(location,operator,TS,offset,timezone)
The syntax for each record selection method is given below.
Record selection by data content
When selecting a record based on specific data content, the syntax of the IF parameter is:
{operator} {oper2}
location
Starting location of the data to search. Any valid actual or relative location can be used.
length
Length of the search field. The value must be at least one byte longer than the data element length. It can be any number from 0 (zero) to 255. Use 0 to scan to the end of the record.
operator
Operator element that represents the condition to test. Any valid operator element listed in Operator Element is allowed.
dupl
Optional duplication factor that defines the number of times File-AID finds the data to be contiguously repeated, starting at the specified location. A dupl element is valid only when an operator element is specified. Otherwise, the dupl value is ignored.
data
Data to search for in the specified location or scan length. Any valid data type listed in Data Element is allowed.
loc2
Location of second entry of multiple entry.
len2
Length of second entry of multiple entry.
oper2
Operator of second entry of multiple entry.
data2
Data of second entry of multiple entry.
Example 1:
Example 1 generates a hexadecimal print of records that contain the string TEST FILE beginning in location 23.
Example2:
$$DD01 PRINT IF=(1,EQ,C’A’,17,EQ,C’1’,17,EQ,C’2’,17,EQ,C’3’)
Example 2 shows two types of coding to print records that contain the character A in location 1, OR have the character 1, 2, or 3 in location 17.
Example 3:
Example 3 prints records that have the character A in location 1, AND have the characters 1, 2, or 3 in location 17.
Example 4:
Example 4 generates a hexadecimal print of records that contain the string TEST FILE beginning in location 23, or beyond.
Record selection by valid numeric or packed data
When selecting a record based on the presence or absence of valid numeric or packed data in a given location, the syntax of the IF parameter is:
IF=(location,length,[dupl] operator-data-type)
location
Starting location of the data to examine. Any valid actual or relative location can be used.
length
Length of the packed or numeric field to check. When numeric data is specified in data-type, you must use a length greater than 0 and less than or equal to 256. When packed data is specified in data-type, you may use a length value of 0 through 16. The 0 length tells File-AID to verify the presence or absence of a packed field of any length (1 to 16 bytes), beginning at the specified location.
dupl
Optional duplication factor that defines the number of times File-AID checks for the condition to be contiguously repeated, starting at the specified location.
operator-data-type
The following operator-data-types are valid:
EQP | Equal packed |
NEP | Not equal packed |
EQN | Equal numeric |
NEN | Not equal numeric |
A value of EQP or NEP checks for packed data. A valid packed field must be signed with C, F, or D.
A value of EQN or NEN checks for numeric data. Valid numeric data must have each byte of the field in zoned decimal format (F0 - F9). The last byte can be signed positive (C0 - C9), negative (D0 - D9), or unsigned (F0 - F9).
Example 5:
Example 5 checks for ten contiguous packed fields of five bytes each beginning in location 20.
Example 6:
Example 6 checks for numeric data beginning in location 6 and continuing for ten bytes.
Example 7:
Example 7 selects records that have five contiguous packed fields of any length beginning in location 20.
Example 8:
Example 8 selects records that do NOT have five contiguous packed fields of any length beginning in location 20.
Record selection by timestamp
When selecting a record based on the presence or absence of a timestamp in a given location, the syntax of the IF parameter is:
IF=(location,operator,TS[+nn],length,timezone)
Timestamp is a 21 byte field in the format yyyymmddThhmmssffffff.
yyyymmdd is the 8 digit year, month and day.
The T is the actual letter T.
hhmmss is the 6 digit hour, minute, and second.
ffffff represents fractions of a second.
location
Starting location of the data to search. Any valid actual or relative location can be used.
operator
Operator element that represents the condition to test. Any valid operator element listed in Operator Element is allowed.
TS[+nn]
Identifies the parameter as a timestamp (TS or TIMESTAMP). TS may have an offset of +0 through +20 specified. If no offset is specified, the default is zero (0) which points at yyyy. TS+4 would point at the 5th position (mm - month).
length
Length (number of timestamp bytes to process) of the timestamp field. Valid values 1-21.
timezone
timezone is the fifth parameter (value following the length) specifies the time zone to use:
LOC or LOCAL specifies local time zone.
UTC specifies Universal Time Coordinated.
GMT specifies Greenwich Meridian Time.
If none is specified, the default is local time.
Example 9:
Example 9 lists records that contain the local timestamp year (yyyy) in positions 34-37.