DATFMT (Date Format) keyword for physical and logical files
You can use this field-level keyword to specify the format of a date field. This keyword is valid only for date fields (data type L) or for logical-file zoned fields (data type S), packed fields (data type P), or character fields (data type A) whose corresponding physical file fields are date fields (data type L).
DATFMT(date-format)
The date-format parameter specifies the format for the date. The following table describes the valid date formats and their default separator values for physical file fields.
|
- You can specify only the DATFMT keyword on the date (L) data type.
- If you do not specify the DATFMT keyword, the default is *ISO.
- Field length values and decimal position values must be blank.
The following table describes the valid date formats and their default separator values for logical files.
Format name | Date format parameter | Date format | Zoned or character field length | Zoned or character example | Packed field length | Packed example (in Hex) |
---|---|---|---|---|---|---|
Job default | *JOB | |||||
Month/Day/Year | *MDY | mmddyy | 6,0 | 062196 | 6,0 or 7,0 | '0062196F'X |
Day/Month/Year | *DMY | ddmmyy | 6,0 | 210696 | 6,0 or 7,0 | '0210696F'X |
Year/Month/Day | *YMD | yymmdd | 6,0 | 960621 | 6,0 or 7,0 | '0960621F'X |
Month/Day/Year (4 digit year) | *MDYY1 | mmddyyyy | 8,0 | 06211996 | 8,0 or 9,0 | '006211996F'X |
Day/Month/Year (4 digit year) | *DMYY1 | ddmmyyyy | 8,0 | 21061996 | 8,0 or 9,0 | '021062006F'X |
Year/Month/Day (digit year) | *YYMD1 | yyyymmdd | 8,0 | 19960621 | 8,0 or 9,0 | '019960621F'X |
Julian | *JUL | yyddd | 5,0 | 96172 | 5,0 | '96172F'X |
Julian (4 digit year) | *LONGJUL1 | yyyyddd | 7,0 | 1996172 | 7,0 | '1996172F'X |
Century/Day/Month/Year | *CMDY1 | cmmddyy | 7,0 | 0062196 | 7,0 | '0062196F'X |
Century/Day/Month/Year | *CDMY1 | cddmmyy | 7,0 | 1210696 | 7,0 | '1210696F'X |
Century/Year/Month/Day | *CYMD1 | cyymmdd | 7,0 | 1960621 | 7,0 | '1960621F'X |
Month/Year | *MY1,2 | mmyy | 4,0 | 0696 | 4,0 or 5,0 | '00696F'X |
Year/Month | *YM1,2 | yymm | 4,0 | 9606 | 4,0 or 5,0 | '09606F'X |
Month/Year (4 digit year) | *MYY1,2 | mmyyyy | 6,0 | 061996 | 6,0 or 7,0 | '0061996F'X |
Year/Month (4 digit year) | *YYM1,2 | yyyymm | 6,0 | 199606 | 6,0 or 7,0 | '0199606F'X |
International Standards Organization | *ISO | yyyymmdd | 8,0 | 19960621 | 8,0 or 9,0 | '019960621F'X |
IBM USA Standard | *USA | mmddyyyy | 8,0 | 19960621 | 8,0 or 9,0 | '006211996F'X |
IBM European Standard | *EUR | ddmmyyyy | 8,0 | 21061996 | 8,0 or 9,0 | '021061996F'X |
Japanese Industrial Standard Christian Era | *JIS | yyyymmdd | 8,0 | 19960621 | 8,0 or 9,0 | '019960621F'X |
- These DATFMTs are not valid for the date (L) type field. They are only valid on logical file zoned, packed, or character types having a physical file based on date type fields.
- DATFMTs that do not have any "days" specified are implied to be day 1 of the specified month.
- The packed (P), zoned (S), character (A), and date (L) data types for logical file fields allow the DATFMT keyword.
- Field length can be specified for packed, character, and zoned logical file fields, but must be a valid value listed in the table.
- If you do not specify the DATFMT keyword and the data type is L, the default is the date format and field length from the corresponding physical file field.
- For packed and zoned data types, the decimal positions (positions 36 and 37) must be blank.
- For the packed data type, two lengths are sometimes allowed for a particular format. The larger length is better from a performance perspective. If you do not specify a length, the smaller length is used as the default.
- If you specify *JOB, the default is the job attribute and the field length and is based on the job attribute without separators.
- If the DFT keyword is not specified, the default value is the current date.
- If you specify the *ISO, *USA, *EUR, or *JIS value, you cannot specify the DATSEP keyword. These date formats have a fixed separator.
- The DATFMT keyword overrides the job attribute for a date field. It does not change the system default.
Example
The following example shows how to specify the DATFMT keyword.
|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
00010A
00020A R RECORD
00030A DATFLD1 L DATFMT(*JUL)
00040A DATFLD2 L DATFMT(*EUR)
A
If the current date is June 21, 1990, the current system date format value is MDY, and the current system separator is /, DATFLD1 contains 90/172 (the 172nd day of the year 1990). DATFLD2 contains 21.06.1990.