IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

If file is empty i should not print any report


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Jeya Raj

New User


Joined: 14 Jan 2007
Posts: 33
Location: USA

PostPosted: Sun Jan 14, 2007 8:23 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Jan 14, 2007 8:34 am
Reply with quote

Hello,

Yes, that should work.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sun Jan 14, 2007 10:06 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sun Jan 14, 2007 10:29 am
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Jan 14, 2007 12:05 pm
Reply with quote

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
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Sun Jan 14, 2007 11:17 pm
Reply with quote

Hello Mr. D...
Yepp, I m getting it now... and agree what you said... sometimes Im very hardhead to understand simple things... icon_mad.gif

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Mon Jan 15, 2007 2:00 am
Reply with quote

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
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Tue Jan 16, 2007 6:42 am
Reply with quote

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
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Mon Jan 22, 2007 4:35 pm
Reply with quote

==============================================
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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top