DATE Function

The DATE function enables the application to obtain one of the following:

  • Gregorian date: mmddyy

  • Julian date: yyddd

The current date can optionally be obtained using the standard COBOL reserved word CURRENT-DATE.

DATE indicates that the date is to be returned in Gregorian format.

DATEJ indicates that the date is to be returned in Julian format.

Format

The format for using the DATE function is:

DATE[J] (retcode, area) 
retcode Required.
A fullword where Com-plete places the return code upon completion of the operation.
area Required.
A four-byte area in the working storage area of the application program where the date will be placed.

The date can be returned in either Gregorian or Julian format. Regardless of the format chosen, the date is returned in a four-byte area identified by the area argument. The format of the data returned in the four-byte field is:

Gregorian Format: X'cmmddyyF'

The first character contains either a leading half-byte of zeros, or the century indicator "c". The characters are:

c = century indicator (c=0=1900; c=1=2000; etc.)
mm = month indicator (01 to 12)
dd = date indicator (01 to 31)
yy = year indicator (00 to 99)

Note that the Gregorian format illustrated above differs from the results returned by the MCALL DATE function for Assembler language programming.

Julian Format: X'0cyydddF'

The last character contains the hexadecimal character F to ensure a valid numerical sign. The remaining characters are:

c = century indicator (c=0=1900; c=1=2000; etc.)
yy = year indicator (00 to 99)
ddd = day indicator (001 to 366)

Return Codes

A return code of 0 is issued upon normal completion of the DATE function.

Abends

An abnormal termination may occur during execution of the DATE function. A possible cause is that an invalid area argument was specified.