DATE (Date) keyword in printer files

Use this field-level keyword to display the current date or the current system date as a constant field 6 or 8 bytes long.

Start of changeYou can specify the DATE keyword and the location of the field. Also, you can name the field with the special name *NONE, if the POSITION keyword is used in the record to specify the location of the fields. Optionally, you can specify the CDEFNT, CHRSIZ, COLOR, EDTCDE, EDTWRD, FNTCHRSET, FONT, HIGHLIGHT, UNDERLINE, or TEXT keyword.End of change

Start of changeIf the POSITION keyword is used, you must specify the name *NONE (positions 19 through 29). If POSITION keyword is not used, positions 17 through 38 must be blank.End of change

The format of the keyword is:
DATE([*JOB | *SYS] [*Y|*YY])

The *JOB value causes the current job date to be printed. If you do not specify a parameter, *JOB is used. The *SYS parameter causes the current system date to be printed.

If you specify *Y, 2 digits represent the year in the date format that the DATFMT job attribute designates. If you specify *YY, 4 digits represent the year in the date format that the DATFMT job attribute designates. If you do not specify a parameter, *Y is specified by default.

The W edit code on the EDTCDE keyword returns a correctly formatted date only if a four digit year (*YY) is requested, and the job attribute DATFMT is YMD.

If you specify EDTCDE(Y) for a DATE field, separators are added according the date format of the DATFMT job attribute. For example, using EDTCDE(Y) when the DATFMT job attribute specifies *MDY changes the date from
mmddyy
to
mm/dd/yy

The slashes (/) represent the job attribute DATSEP at run time and the job attribute DATFMT determines the order of the month, day, and year. (DATFMT can be *SYSVAL, indicating that your program is to retrieve the date from the system value QDATFMT, or MDY, DMY, YMD, or JUL, where M=month, D=day, Y=year, and JUL=Julian.)

Field length depends on the following factors:

  1. The format of the DATFMT job attribute.
  2. Whether the date field includes separators. The EDTCDE keyword controls separators.
  3. The number of digits that represent the year. The DATE keyword controls the number of year digits.

If the DATFMT specified for the job is *JUL (Julian), you cannot use the EDTWRD keyword to edit the result.

Option indicators are not valid for this keyword. However, option indicators can be used to condition the field associated with this keyword.

Example

The following example shows how to specify the DATE keyword.

|...+....1....+....2....+....3....+....4....+....5....+....6....+....7....+....8
     A          R REC01
     A                                  1 56
     A                                      DATE
     A  21                              2 56
     A                                      DATE(*JOB *Y)
     A  22                              2 56
     A                                      DATE EDTCDE(Y)
     A  23                              2 56
     A                                      DATE(*JOB) EDTCDE(Y)
     A  24                              2 56
     A                                      DATE(*SYS)
     A  25                              2 56
     A                                      DATE(*SYS *YY) EDTCDE(Y)
     A

The job date is printed without editing on line position 56.

The job date is also printed without editing if option indicator 21 is on. The job date is printed with editing, if either option indicator 22 or 23 is on. The system date is printed without editing, if option indicator 24 is on. The system date is printed with editing and a 4 digit year, if option indicator 25 is on.

Related concepts
Constant fields in printer files