View previous topic :: View next topic
|
Author |
Message |
Jeya Raj
New User
Joined: 14 Jan 2007 Posts: 33 Location: USA
|
|
|
|
Hi,
I'm writing into a file in my COBOL program. If that file is empty i should not print any report. If the file is empty i need to set the Return Code in COBOL program so that i can check the RC in JCL before executing the step.
I put the counter after writing into that file. Before EOJ i checked for the counter. If the counter is '0' then i moved 60 to RC. Is this correct?. If not please let me know the answer with example.
Thanks, |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Yes, that should work. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Whats the real need of a counter here... when you can just check for an EoF (End of File) after the first READ irself.... and do whatever you want at Eof on very first READ.... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Priyesh,
The counter is for the program before the program that reads the file (if i understood the post).
By setting the condition code and skipping the "read" step (and possibly others that need to read the file) the process may be clearer and will eliminate a bit of overhead. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
If the pgm is creating the report it sounds like he'd have to "print" it to a flat file, then use IDCAMS or some such to decide to run a copy step to spool it if there's data in the file. |
|
Back to top |
|
|
priyesh.agrawal
Senior Member
Joined: 28 Mar 2005 Posts: 1448 Location: Chicago, IL
|
|
|
|
Hello Mr. D...
Yepp, I m getting it now... and agree what you said... sometimes Im very hardhead to understand simple things...
Jack... Good Morning... I have a doubt, if you dont mind pls...
Assume a scenario where that program is printing a Header Record along with detail record... IDCAMS approach may still print the report where there is No detail records but a header record... which surely user would not have thought of... |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I was thinking of a situation where a data file was sometimes created (i.e. quarterly commission information) that would need a report printed as well as being fed into the corporate General Ledger system. If it wasn't the quarterly run, this file would not be created and so the quarterly commission report program should not be executed.
The G/L system might get "standard" input from multiple sub-systems and process them all via a single DD reading all generations of the glinput GDG.
This was how we implemented our sales, payroll, g/l and several other "corporate" systems as we had to handle 340+ manufacturing and distribution facilities. . . . Some jobs ran every day from each locale - some weekly - some multiple times a day, some "special" runs, etc.
Using condition codes and placing the "new" data in the appropriate format in the +1 version of the right gdg allowed us to have fewer job and fewer datasets to maintain. |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Priyesh,
I misread the problem. I thought the action was taking place in the report creation pgm.
BTW, I ALWAYS print an "empty" report with headings and a detail line that states:
*~==========> NO DATA TO REPORT TODAY <==========~*
It avoids confusion either now or later about whether or not the report for that day was lost or misplaced. |
|
Back to top |
|
|
sachin_star3 Warnings : 1 New User
Joined: 30 Sep 2006 Posts: 78 Location: pune
|
|
|
|
==============================================
ANSWER:
THERE ARE THREE WAYS YOU CAN DO
1] IN PROGRAMME: IF FILE IS EMPTY YOU GET THE LASTCC
SO USE MODAL COMMAND IN YOUR COBOL PROGRAME
SET THE CONDITION(IF TRUE NOT PRINT IF FALSE THEN PRINT)
2) USING PROGRAME: DEFINE THE ONE VARIABLE WITH PIC 99,AND THEN MOVE RC TO A(VARIABLE NAME)
AND FOLLOW THE IF ELSE
3)USING JCL:-
// IF ( S1 RC 0 ) THEN
//-------IMPERATIVE STATEMENTS----
//ELSE
//IMPERATIVE STATEMENTS
----------------------------------------------------------------------------- |
|
Back to top |
|
|
|