COBOL Manual for TNS and TNS/R Programs

Procedure Division Verbs
HP COBOL Manual for TNS and TNS/R Programs—522555-006
9-8
ACCEPT With DATE, DAY, DAY-OF-WEEK, or TIME
Phrase
DAY-OF-WEEK
delivers the value of the current day of the week expressed as an integer between
1 and 7, inclusive. The value 1 represents Monday, 2 represents Tuesday, and so
on.
TIME
delivers the current time of day. TIME behaves like a data item described with the
PICTURE character-string 9(8) organized as four pairs of digits—hhmmsscc,
where hh is the hour (based on a 24-hour clock), mm is the minutes, ss is the
seconds, and cc is the hundredths of seconds. For example, 2:41 p.m. is
expressed as 14410000. The minimum value of TIME is 00000000; the maximum
value is 23595999.
In Example 9-4, ACCEPT statements tell the executing process to store the current
day of the week (integer) in DAY-SUB, the current date (yymmdd ) in TODAYS-DATE,
the current time (hhmmsscc ) in TIME-RIGHT-NOW, and 40 characters from the home
terminal in USER-REPLY.
Example 9-4. ACCEPT Statements Reading Current Data and Time
WORKING-STORAGE SECTION.
01 DATE-AND-TIME-FIELDS.
05 DAY-SUB PIC 9 VALUE ZERO.
05 TODAYS-DATE PIC 9(6) VALUE ZERO.
05 TIME-RIGHT-NOW PIC 9(8) VALUE ZERO.
77 USER-REPLY PIC X(40) VALUE SPACES.
...
PROCEDURE DIVISION.
...
ACCEPT DAY-SUB FROM DAY-OF-WEEK
ACCEPT TODAYS-DATE FROM DATE
ACCEPT TIME-RIGHT-NOW FROM TIME
ACCEPT USER-REPLY