The ACCEPT verb is used to get data from the keyboard, a peripheral device, or certain system variables.
ACCEPT notes
When the first format is used, the ACCEPT inserts the data typed at the keyboard (or coming from the peripheral device), into the receiving data-item.
When the second format is used, the ACCEPT inserts the data obtained from one of the system variables, into the receiving data-item.
Using the ACCEPT to get the system date and time
The second format of the ACCEPT allows the programmer to access the system date and time (i.e.the date and time held in the computer's internal clock). The system variables provided are -
* Date
* Day of the year
* Day of the week
* Time
The declarations and comments below show the format required for data-items receiving each of the system variables.
01 CurrentDate PIC 9(6).
* CurrentDate is the date in YYMMDD format
01 DayOfYear PIC 9(5).
* DayOfYear is current day in YYDDD format
01 Day0fWeek PIC 9.
* DAY-OF-WEEK is a single digit where 1=Monday
01 CurrentTime PIC 9(8).
* CurrentTime is the time in HHMMSSss format where s = S/100
New formats for the ACCEPT
The problem with ACCEPT ..FROM DATE and ACCEPT..FROM DAY is that since they hold only the year in only two digits, they are subject to the millennium bug. To resolve this problem, these two formats of now take additional (optional) formatting instructions to allow the programmer to specify that the date is to be supplied with a 4 digit year.
The syntax for these new formatting instructions is:
ACCEPT DATE [YYYYMMDD]
ACCEPT DAY [YYYYDDD]
When the new formatting instructions are used, the receiving fields must be defined as;
01 Y2KDate PIC 9(8).
* Y2KDate is the date in YYYYMMDD format
01 Y2KDayOfYear PIC 9(7).
* Y2KDayOfYear is current day in YYYYDDD format
Appointment Letter
-
May 2, 1991 Mrs. Leonida SantosTeacher IIINational High SchoolHi-way,
Zamboanga City Dear Mrs. Santos: You are hereby appointed as Poll Clerk of
the Board ...
No comments:
Post a Comment