View previous topic :: View next topic
|
Author |
Message |
mf_user Currently Banned New User
Joined: 05 Jan 2006 Posts: 47
|
|
|
|
Hi,
I've two questions.
1). How to set a subscript or index to zero AUTOMATICALLY when it reaches it's max count. We should not use any "move 0 to subscript" or "set index to 0" in the code. Is it possible?
2). How to execute a program on Friday's only with COBOL logic? Is this possible too?
Any help? Any sample codes? |
|
Back to top |
|
|
BruceC
New User
Joined: 14 Mar 2006 Posts: 6 Location: Los Angeles
|
|
|
|
How to execute only on Friday...
Does this mean the program starts, discovers it is not Friday and halts?
Or does it mean the program starts, discovers its Friday and starts another COBOL program, perhaps a called program?
Or does it mean a COBOL program that does not have to run to find if it is Friday, perhaps by being in a load library that is run from another job?
Mainframe COBOL programs running under LE can use LE services to find the day. It is rarely done since a job may start on one day and end on another, but the day can be found. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Not sure what you mean by "max count".
If you mean it's pic 99 and it's reached "99" just bump it by 1. That resets it to zero. |
|
Back to top |
|
|
mf_user Currently Banned New User
Joined: 05 Jan 2006 Posts: 47
|
|
|
|
Thanks mmwife. I tried it and it worked the way intended.
BruceC, sorry for the confusion. I should produce the output files only on Friday. Other day, it should end with a return code of 200.
Any idea? |
|
Back to top |
|
|
BruceC
New User
Joined: 14 Mar 2006 Posts: 6 Location: Los Angeles
|
|
|
|
I find the examples in the COBOL and LE manuals incomplete as the important feedback code is changed to MOITTED. So, here is a code sample.
Test environment: z/OS 1.4 compiler: IBM Enterprise COBOL for z/OS
Code: |
ID DIVISION.
PROGRAM-ID. TESTFUNC.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 YYYYMMDD PIC 9(08).
01 SHOW-DAY PIC ZZZZZZZZ9.
01 CEEDATE-INPUT.
05 CEEDATE-INPUT-LEN COMP PIC S9(04) VALUE +8.
05 CEEDATE-INPUT-DATE PIC 9(08) VALUE 0.
01 CEEDATE-OUTPUT.
05 CEEDATE-OUTPUT-LEN COMP PIC S9(04) VALUE +8.
05 CEEDATE-OUTPUT-DATE PIC X9(08) VALUE 'YYYYMMDD'.
01 CEEDATE-LILIAN BINARY PIC S9(08) VALUE +0.
01 CEEDATE-FEEDBACK.
05 CEEDATE-RC COMP PIC S9(04) VALUE +8.
05 CEEDATE-MSG COMP PIC S9(04) VALUE +8.
05 PIC X(08) VALUE ' '.
01 CEEDATE-DAYNUM BINARY PIC S9(09) VALUE +0.
88 FRIDAY VALUE +6.
PROCEDURE DIVISION.
* Function: Display today's date in Gregorian format *
MOVE FUNCTION CURRENT-DATE(1:8) TO YYYYMMDD
DISPLAY 'YYYYMMDD: ' YYYYMMDD
MOVE YYYYMMDD TO CEEDATE-INPUT-DATE
* Function: Find today's Lilian date (integer format) *
CALL 'CEEDAYS' USING
CEEDATE-INPUT,
CEEDATE-OUTPUT,
CEEDATE-LILIAN,
CEEDATE-FEEDBACK
END-CALL
IF CEEDATE-FEEDBACK > ZERO
DISPLAY 'CEEDAYS error converting ' CEEDATE-INPUT-DATE
MOVE +12 TO RETURN-CODE
GOBACK
END-IF
* Function: use CEEDYWK to return the day of the week
CALL 'CEEDYWK' USING
CEEDATE-LILIAN,
CEEDATE-DAYNUM,
CEEDATE-FEEDBACK
END-CALL
IF CEEDATE-FEEDBACK > ZERO
DISPLAY 'CEEDYWK error converting Lilian date'
MOVE +12 TO RETURN-CODE
GOBACK
END-IF
IF FRIDAY
DISPLAY 'Friday processing started'
ELSE
MOVE +200 TO RETURN-CODE
GOBACK
END-IF
GOBACK.
|
|
|
Back to top |
|
|
|