View previous topic :: View next topic |
Author |
Message |
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
|
Posted: Sun Dec 01, 2002 10:45 pm Post subject: Day of week |
|
|
Code: |
01 WS-DIVIDE-ANSWER PIC S9(08) COMP.
01 WS-INTEGER PIC S9(08) COMP.
01 WS-REMAINDER PIC S9(04) COMP.
01 WS-CCYYMMDD-NUM PIC 9(08).
01 WS-CCYYMMDD REDEFINES WS-CCYYMMDD-NUM.
05 WS-CCYYMMDD-CCYY-NUM PIC 9(04).
05 WS-CCYYMMDD-CCYY REDEFINES WS-CCYYMMDD-CCYY-NUM.
10 WS-CCYYMMDD-CC PIC 9(02).
10 WS-CCYYMMDD-YY PIC 9(02).
05 WS-CCYYMMDD-MM PIC 9(02).
05 WS-CCYYMMDD-DD PIC 9(02).
01 WS-DOW-TABLE.
05 FILLER PIC X(21) VALUE
'SUNMONTUEWEDTHUFRISAT'.
01 FILLER REDEFINES WS-DOW-TABLE.
05 WS-DOW-ENTRY PIC X(03) OCCURS 7 TIMES.
01 WS-DAY-OF-WEEK PIC X(03).
10000-GET-DAYOFWEEK.
COMPUTE WS-INTEGER = FUNCTION INTEGER-OF-DATE(WS-CCYYMMDD-NUM).
DIVIDE WS-INTEGER BY 7 GIVING WS-DIVIDE-ANSWER
REMAINDER WS-REMAINDER.
ADD 1 TO WS-REMAINDER.
MOVE WS-DOW-ENTRY (WS-REMAINDER) TO WS-DAY-OF-WEEK.
|
|
|
Back to top |
|
|
Manas Biswal Intermediate
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Mon Dec 02, 2002 5:52 am Post subject: |
|
|
If we are using LE-COBOL, then we can directly use the CEEDYWK service to calculate the day of the week.
Regards,
Manas |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Tue Dec 17, 2002 4:35 am Post subject: |
|
|
I am doing VS COBOL II - CICS coding. When I use statement -
COMPUTE WS-CNT = FUNCTION INTEGER-OF-DATE(11111111)
And following error I am getting -
I "FUNCTION" was specified as an informational word in the current reserved wo...
used may be different from the IBM-supplied default. Refer to VS COBOL II A...
Reference for information on reserved words.
S "FUNCTION" was not defined as a data-name. The statement was discarded.
S "INTEGER-OF-DATE" was invalid. Skipped to the next verb, period or procedur...
I looked in VS COBOL II manual and "INTEGER-OF-DATE" is not there. Am I right to conclude that VS COBOL II doesn't have functions. |
|
Back to top |
|
|
Manas Biswal Intermediate
Joined: 29 Nov 2002 Posts: 382 Topics: 27 Location: Chennai, India
|
Posted: Tue Dec 17, 2002 7:44 am Post subject: |
|
|
Hi Dibakar,
What I do know is that the function INTEGER-OF-DATE is supported on COBOL/370 and COBOL for MVS. Never have used that function in VS COBOL II. By the way if you are writing a CICS-COBOL application program, why don't you use FORMATTIME. That should be able to solve most of the date problems.
Regards,
Manas |
|
Back to top |
|
|
Dibakar Advanced
Joined: 02 Dec 2002 Posts: 700 Topics: 63 Location: USA
|
Posted: Wed Dec 18, 2002 2:33 am Post subject: |
|
|
Yes, I am using FormatTime but wanted to experiment with Cobol functions. |
|
Back to top |
|
|
|
|