Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

If file is empty i should not print any report

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: If file is empty i should not print any report
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

Site Director


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

PostPosted: Sun Jan 14, 2007 8:34 am    Post subject:
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: 1452
Location: Chicago, IL

PostPosted: Sun Jan 14, 2007 10:06 am    Post subject: Re: Empty file -cobol
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

Site Director


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

PostPosted: Sun Jan 14, 2007 10:29 am    Post subject:
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    Post subject:
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: 1452
Location: Chicago, IL

PostPosted: Sun Jan 14, 2007 11:17 pm    Post subject: Re: If file is empty i should not print any report
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

Site Director


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

PostPosted: Mon Jan 15, 2007 2:00 am    Post subject:
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am
No new posts File processing vishwakotin Mainframe Interview Questions 9 Fri Apr 28, 2017 11:38 am
No new posts Occurrence of various strings within ... TS70363 JCL & VSAM 1 Thu Apr 27, 2017 8:18 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us