Date, time, and timestamp fields used by record keys (FROMKEY and TOKEY)
When the number of key fields and a value are used to specify the FROMKEY or TOKEY parameter, no conversion of data occurs if the corresponding key field in the from-file is a date, time, or timestamp field.
The user input string that you specify (including the separators) must be in the same format as the date, time, or timestamp field. If it is not, a file open error might occur, or the records copied might not be the result that you want. If *BLDKEY is specified for the FROMKEY or TOKEY parameter and the corresponding key field in the from-file is a date, time, or timestamp field, the system attempts to convert the user-input key field value to the format (and separators) of the from-file field. The following rules apply to the conversion:
- If the from-field is a date key field, the system first determines if the user-input key value is in the same format and has the same separator as specified in the current job under which the copy command is running. This can be *MDY, *DMY, *YMD, or *JUL for the format and slash (/), hyphen (-), period (.), comma (,), or blank ( ) for the separator. If the user-input key value is not in the current job specified format and separator form, it determines if it is in one of the Systems Application Architecture® (SAA®) formats (*ISO, *USA, *EUR, or *JIS). It also determines if it is in a YYYYDDD form (no separator). If the system can determine the user-input key value is in one of these forms, the input string is converted to the actual format (and separator) of the from-file date field, which is used for the key comparison. If the user-input string format cannot be determined or the length or data value is not valid, the system issues a diagnostic message. You must left-justify the date portion of the user-input key value; it can contain trailing blanks.
- If the from-field is a time key field, the system first determines if the user-input key value is in the same format and has the same separator as specified in the current job under which the copy command is running. This might be HHMMSS for the format and colon (:), comma (,), period (.), or blank ( ) for the separator. If the user-input key value is not in the current job specified format and separator form, the system determines if it is in one of the SAA formats (*ISO, *USA, *EUR, or *JIS). If the system can determine the user-input key value is in one of these forms, the input string is converted to the actual format (and separator) of the from-file time field, which is used for the key comparison. If the user-input string format cannot be determined, or the length or data value is not valid, the system issues a diagnostic message. You must left-justify the time portion of the user-input key value; it can contain trailing blanks.
- If the from-field is a timestamp key field, the system first determines if the user-input key value is in the SAA format or YYYYMMDDHHMMSS form. If the system determines the user-input key value is in one of these forms, the input string is converted to the actual SAA timestamp format, which is used for the key comparison. If the user-input string format cannot be determined, or the length or data value is not valid, the system issues a diagnostic message. You must left-justify the timestamp portion of the user-input key value; it can contain trailing blanks.
Parent topic:
Selecting records by record keys (FROMKEY and TOKEY parameters)