DATFMT (Date Format) keyword for display files

Use this field-level keyword to specify the format of a date field. This keyword is only valid for date fields (data type L).

The format of the keyword is:

DATFMT(date-format)

The date-format parameter specifies date formats. The following table describes the valid date formats and their default separator values.

Format name Date-format parameter Date format and separator Field length Example
Job default *JOB      
Month/Day/Year *MDY mm/dd/yy 8 06/21/90
Day/Month/Year *DMY dd/mm/yy 8 21/06/90
Year/Month/Day *YMD yy/mm/dd 8 90/06/21
Julian *JUL yy/ddd 6 90/172
International Standards Organization *ISO yyyy-mm-dd 10 1990-06-21
IBM® USA Standard *USA mm/dd/yyyy 10 06/21/1990
IBM European Standard *EUR dd.mm.yyyy 10 21.06.1990
Japanese Industrial Standard Christian Era *JIS yyyy-mm-dd 10 1990-06-21

If you do not specify the DATFMT keyword, the default is *ISO.

If you specify *JOB, the high level language and the application handle the format as *ISO. On output the system converts the format to the format specified by the Date Format Job Definition Attribute. On input, the system converts the format to *ISO before it passes control to the application. There are always 10 spaces reserved on the display screen for a Date field with DATFMT(*JOB), even though 8 characters in the case of *MDY, *DMY, and *YMD, or 6 characters in the case of *JUL are displayed.

The format of DFT, DFTVAL, and MAPVAL keyword values must match the format that the DATFMT keyword specifies. If the DATFMT keyword specifies *JOB or the DATFMT keyword is set to *ISO as default, these values must have a format of *ISO.

If you specify the *ISO, *USA, *EUR, or *JIS value, you cannot specify the DAT keyword. These date formats have fixed separators.

The DATFMT keyword overrides the job attribute for a date field. It does not change the system default.

It is the responsibility of the high-level language and the application to format the date field according to the format specified on the DATFMT keyword and use the separators specified on the DATSEP keyword. The system does not format fields on output. The system validates the date field (L data type) on input according to the format the DATFMT keyword specifies and the separator that the DATSEP keyword specifies.

Option indicators are not valid for this keyword, although option indicators can be used to condition the field for which it is specified.

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  B  5  2DATFMT(*JUL)
00040A            DATFLD2         L  B  5 22DATFMT(*EUR)
00050A            DATFLD3         L  B  5 42DATFMT(*JOB)
     A

If the date to be displayed is June 21, 1990, the date format defined in the Job Definition Attributes is *MDY and the date separator defined in the Job Definition Attributes is a slash (/), the following values are displayed when RECORD is written.

DATFLD1     90/172
DATFLD2     21.06.1990
DATFLD3     06/21/90