|
CEEDYWK calculates
the day of the week on which a Lilian date falls. The day of the week
is returned to the calling routine as a number between 1 and 7. The
number returned by CEEDYWK is useful for end-of-week calculations.
Syntax
>>-CEEDYWK--(--input_Lilian_date--,--output_day_no--,--fc--)---><
- input_Lilian_date (input)
- A 32-bit binary integer representing the Lilian date, the number
of days since 14 October 1582. For example, 16 May 1988 is day number
148138. The valid range of input_Lilian_date is
between 1 and 3,074,324 (15 October 1582 and 31 December 9999).
- output_day_no (output)
- A 32-bit binary integer representing input_Lilian_date's
day-of-week: 1 equals Sunday, 2 equals Monday, ..., 7 equals Saturday.
If input_Lilian_date is invalid, output_day_no is
set to 0 and CEEDYWK terminates with a non-CEE000 symbolic feedback
code.
- fc (output)
- A 12-byte feedback code, optional in some languages,
that indicates the result of this service. If you choose to omit this
parameter, refer to Invoking callable services for the
appropriate syntax to indicate that the feedback code was omitted.
The
following symbolic conditions can result from this service:
Code |
Severity |
Message number |
Message text |
---|
CEE000 |
0 |
— |
The service completed successfully. |
CEE2EG |
3 |
2512 |
The Lilian date value passed in a call to CEEDATE or CEEDYWK
was not within the supported range. |
Usage notes - z/OS UNIX consideration—In
multithread applications, CEEDYWK affects only the calling thread.
- COBOL consideration—The
CEEDYWK callable service has different values than the COBOL ACCEPT
statement with conceptual data item DAY-OF-WEEK. Use one or the other,
not both.
Examples - Following is an example of CEEDYWK called by C/C++.
/*Module/File Name: EDCDYWK */
#include <string.h>
#include <stdio.h>
#include <leawi.h>
#include <stdlib.h>
#include <ceeedcct.h>
int main (void) {
_INT4 in_date, day;
_FEEDBACK fc;
in_date = 139370; /* Thursday */
CEEDYWK(&in_date,&day,&fc);
if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
printf("CEEDYWK failed with message number %d\n",
fc.tok_msgno);
exit(2999);
}
printf("Lilian date %d, occurs on a ",in_date);
switch(day) {
case 1: printf("Sunday.\n");
break;
case 2: printf("Monday.\n");
break;
case 3: printf("Tuesday.\n");
break;
case 4: printf("Wednesday.\n");
break;
case 5: printf("Thursday.\n");
break;
case 6: printf("Friday.\n");
break;
case 7: printf("Saturday.\n");
break;
default: printf(
" ERROR! DAY RETURN BY CEEDYWK UNKNOWN\n");
break;
}
}
- Following is an example of CEEDYWK called by COBOL.
CBL LIB,QUOTE
*Module/File Name: IGZTDYWK
************************************************
** **
** CBLDYWK - Call CEEDYWK to calculate the **
** day of the week from Lilian date **
** **
** In this example, a call is made to CEEDYWK **
** to return the day of the week on which a **
** Lilian date falls. (A Lilian date is the **
** number of days since 14 October 1582) **
** **
************************************************
IDENTIFICATION DIVISION.
PROGRAM-ID. CBLDYWK.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 LILIAN PIC S9(9) BINARY.
01 DAYNUM PIC S9(9) BINARY.
01 IN-DATE.
02 Vstring-length PIC S9(4) BINARY.
02 Vstring-text.
03 Vstring-char PIC X,
OCCURS 0 TO 256 TIMES
DEPENDING ON Vstring-length
of IN-DATE.
01 PICSTR.
02 Vstring-length PIC S9(4) BINARY.
02 Vstring-text.
03 Vstring-char PIC X,
OCCURS 0 TO 256 TIMES
DEPENDING ON Vstring-length
of PICSTR.
01 FC.
02 Condition-Token-Value.
COPY CEEIGZCT.
03 Case-1-Condition-ID.
04 Severity PIC S9(4) BINARY.
04 Msg-No PIC S9(4) BINARY.
03 Case-2-Condition-ID
REDEFINES Case-1-Condition-ID.
04 Class-Code PIC S9(4) BINARY.
04 Cause-Code PIC S9(4) BINARY.
03 Case-Sev-Ctl PIC X.
03 Facility-ID PIC XXX.
02 I-S-Info PIC S9(9) BINARY.
PROCEDURE DIVISION.
PARA-CBLDAYS.
** Call CEEDAYS to convert date of 6/2/88 to
** Lilian representation
MOVE 6 TO Vstring-length of IN-DATE.
MOVE "6/2/88" TO Vstring-text of IN-DATE(1:6).
MOVE 8 TO Vstring-length of PICSTR.
MOVE "MM/DD/YY" TO Vstring-text of PICSTR(1:8).
CALL "CEEDAYS" USING IN-DATE, PICSTR,
LILIAN, FC.
** If CEEDAYS runs successfully, display result.
IF CEE000 of FC THEN
DISPLAY Vstring-text of IN-DATE
" is Lilian day: " LILIAN
ELSE
DISPLAY "CEEDAYS failed with msg "
Msg-No of FC UPON CONSOLE
STOP RUN
END-IF.
PARA-CBLDYWK.
** Call CEEDYWK to return the day of the week on
** which the Lilian date falls
CALL "CEEDYWK" USING LILIAN , DAYNUM , FC.
** If CEEDYWK runs successfully, print results
IF CEE000 of FC THEN
DISPLAY "Lilian day " LILIAN
" falls on day " DAYNUM
" of the week, which is a:"
** Select DAYNUM to display the name of the day
** of the week.
EVALUATE DAYNUM
WHEN 1
DISPLAY "Sunday."
WHEN 2
DISPLAY "Monday."
WHEN 3
DISPLAY "Tuesday"
WHEN 4
DISPLAY "Wednesday."
WHEN 5
DISPLAY "Thursday."
WHEN 6
DISPLAY "Friday."
WHEN 7
DISPLAY "Saturday."
END-EVALUATE
ELSE
DISPLAY "CEEDYWK failed with msg "
Msg-No of FC UPON CONSOLE
STOP RUN
END-IF.
GOBACK.
- Following is an example of CEEDYWK called by PL/I.
|