CMP_DATE
(Can be used in FASTREXX condition expressions.)
CMP_DATE is a Boolean function which can be run with or without a template. It enables you to perform a conditional test against date values in a field.
- The date value can also include a time component.
- If the field is defined as a date and time field in the template, imask and omask do not need to be specified as File Manager takes these values from the template.
- The Field name (fieldname), field reference (#nn), operator (operator), and non-numeric values should all be enclosed in quotation marks to avoid syntax errors.
- Commas following the last specified argument can be omitted.
- #nn or fieldname
-
- #nn
- Use this form when providing free-format criteria during template edit. nn is the field reference number displayed during template edit. It is not valid to use fieldname for a field reference when providing criteria during template edit.
- fieldname
- Use this form of identifying fields when coding user procedures. For non-unique names, you can specify a name in the form groupname.dataname. Name matching is not case-sensitive. If the name is unqualified, then the first occurrence of the name is used. Do not code #nn values in user procedures, as the displayed field reference values do not identify the correct field when running from a user procedure.
- subscript
- This applies only to dimensioned fields. You can specify
one of these forms:
- (ANY)
- This is the default if you do not specify a subscript for a dimensioned field and it indicates that at least one element of the associated array must satisfy the condition for a true result.
- (ALL)
- This indicates that all elements of the associated array must satisfy the condition for a true result.
- (nn)
- This refers to a single array element and you should provide a valid subscript for the dimensioned field.
- start
- Position, in bytes, in the input record at which to start reading
the field value. Can be specified as:
- Absolute position
- Must be a positive integer. Default value is 1. If start is greater than the current length of the input record, the function has no effect.
- Relative to current INPOS
- Can be specified as IPx or INx, or as Px or Nx. If this resolves to a value of less than or equal to zero or greater than the current length of the input record, the function has no effect.
- Relative to current OUTPOS
- Must be specified as OPx or ONx. If this resolves to a value of less than or equal to zero or greater than the current length of the input record, the function has no effect.
- length
- The length of the field in bytes.
For binary fields, either omit the length or specify 4.
For packed decimal fields, if you specify the length, it must be in the range 1–16. If you omit the length, CMP_DATE attempts to determine the packed field length from the record data and returns only that field.
For zoned decimal fields the length must be in the range 1-32.
- type
- The data type of the field. Valid values are:
- B
- Binary.
- C
- Character. This is the default.
- P
- Packed decimal.
- B
- Zoned decimal.
- imask
- A value or picture string that defines the format used to store
the date in the field. For a picture string, File Manager supports
all pictures described in the z/OS® Language Environment® Programming
Services, Appendix B, "Date and time services tables".
File Manager also supports specifying one of the following values:
- CBLDATE
- COBOL date (the number of days since 31 December 1600).
- CYYDDD
- Julian date with C as the century indicator (0 = 1900s, 1 = 2000s)
- LILDATE
- Lilian date (the number of days since 14 October 1582)
- LILTIME
- Date and time stored as the number of seconds since 00:00:00 14 October 1582.
- STCK
- Date and time stored as a TOD clock value.
- STCKE
- Date and time stored as an extended TOD clock value.
An imask value must be available for File Manager to use. If a template is used and imask is not specified, File Manager uses the internal mask saved in the template.
- omask
- A picture string that describes the format used for the date values
passed as parameters to CMP_DATE. File Manager supports all pictures
described in the z/OS® Language Environment® Programming
Services, Appendix B, "Date and time services tables".
An omask value must be available for File Manager to use. If a template is used and omask is not specified, File Manager uses the output mask saved in the template.
- operator
- The default is EQ or =. This function supports all the operators described for dynamic template and criteria edit. For details about the operators supported and their description, see:
- value
- The value or values must be valid in the context of the operator and the field which is being referenced. For example, only certain operators like CO (contains) allow multiple values. The format of a value must be a based on the date format described by omask.
- tally_literal
- Specify a literal to appear on a tally report that counts every true result from the CMP_DATE function.
Example 1
Process only those records with a START-DATE value that falls on a Monday or is in the month of May.
IF CMP_DATE('START-DATE',,'Www Mmm DD,YYYY','CO','Mon','May') THEN
RETURN
ELSE
RETURN 'DROP'
Example 2
Process only those records with a 5 byte packed decimal field positioned at byte 34 that contains a Julian date value after the 31st of December 2009.
IF CMP_DATE(34,5,P,'CYYDDD','YYYY-MM-DD','GT','2009-12-31') THEN
RETURN
ELSE
RETURN 'DROP'