ILE COBOL Language Reference

Format 2 - System Information Transfer

System information contained in the specified conceptual data items DATE, DAY, DAY-OF-WEEK, or TIME can be transferred into the identifier. DATE, DAY, DAY-OF-WEEK, and TIME are conceptual data items and, therefore, are not described in the COBOL program. The transfer must follow the rules for the MOVE statement without the CORRESPONDING phrase. See MOVE Statement.

ACCEPT Statement - Format 2 - System Info Transfer
 
>>-ACCEPT--identifier-1--FROM--+-DATE--+---------------+-+------>
                               |       |          (1)  | |
                               |       '-YYYYMMDD------' |
                               +-DAY--+--------------+---+
                               |      |         (1)  |   |
                               |      '-YYYYDDD------'   |
                               +-DAY-OF-WEEK-------------+
                               '-TIME--------------------'
 
>--+-----------------+-----------------------------------------><
   |            (1)  |
   '-END-ACCEPT------'
 
 

Notes:

  1. IBM Extension

identifier-1
The receiving data item.

+-------------------------------IBM Extension--------------------------------+

If the description of identifier-1 contains a TYPE clause, the type-name referenced in that clause must be elementary.

+----------------------------End of IBM Extension----------------------------+

Format 2 accesses the current date and time of day, as carried by the system. This can be useful in identifying when a particular run of an object program was executed. It can also be used to supply the date in headings and footings.

Note:
The current date and time are also accessible using the CURRENT-DATE Intrinsic Function (see CURRENT-DATE).

DATE, DAY, DAY-OF-WEEK, and TIME

The conceptual data items DATE, DAY, DAY-OF-WEEK, and TIME implicitly have USAGE DISPLAY.

DATE (Without the YYYYMMDD Phrase)
Has the implicit PICTURE 9(6).

The sequence of data elements (from left to right) is:

2 digits for year of century
2 digits for month of year
2 digits for day of month

Thus, 16 November 1963 is expressed as:

631116

+-------------------------------IBM Extension--------------------------------+

DATE (With the YYYYMMDD Phrase)
Has the implicit PICTURE 9(8).

The sequence of data elements (from left to right) is:

4 digits for year in the Gregorian calendar
2 digits for month of year
2 digits for day of month

Thus, 16 November 1963 is expressed as:

19631116

+----------------------------End of IBM Extension----------------------------+

DAY (Without the YYYYDDD Phrase)
Has the implicit PICTURE 9(5).

The sequence of data elements (from left to right) is:

2 digits for year of century
3 digits for day of year

Thus 25 December 1988 is expressed as:

88360

+-------------------------------IBM Extension--------------------------------+

DAY (With the YYYYDDD Phrase)
Has the implicit PICTURE 9(7).

The sequence of data elements (from left to right) is:

4 digits for year in the Gregorian calendar
3 digits for day of year

Thus, 31 December 1995 is expressed as:

1995365

+----------------------------End of IBM Extension----------------------------+

DAY-OF-WEEK
Has the implicit PICTURE 9(1).

The single data element represents the day of the week thus:

1 represents Monday
2 represents Tuesday
3 represents Wednesday
4 represents Thursday
5 represents Friday
6 represents Saturday
7 represents Sunday

Thus Thursday is expressed as: 4

TIME
Has the implicit PICTURE 9(8).

The sequence of data elements (from left to right) is:

2 digits for hour of day
2 digits for minute of hour
2 digits for second of minute
2 digits for hundredths of second

Thus 12.25 seconds after 2:41 PM is expressed as:

14411225


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]