Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
How to set the return code in cobol for empty output file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests
View previous topic :: :: View next topic  
Author Message
Prabha
Warnings : 2

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Thu Jun 21, 2007 10:46 pm    Post subject: How to set the return code in cobol for empty output file
Reply with quote

Hi all,

If my program generates empty output file in jcl, then next step in that jcl should not run. For that how will you set the return code in program and how will you pass it thru JCL.

Step1 Exec Pgm=cobol1
Step2 exec Pgm=cobol2

If cobol1 produces empty output file, then step2 should not run.

Help me out this..
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4650
Location: Raleigh, NC, USA

PostPosted: Fri Jun 22, 2007 12:10 am    Post subject: Re: How to set the return code in cobol for empty output fil
Reply with quote

See this previous topic.
Back to top
View user's profile Send private message
twissi

Active User


Joined: 01 Aug 2005
Posts: 105
Location: Somerset, NJ

PostPosted: Fri Jun 22, 2007 10:23 pm    Post subject:
Reply with quote

Praba,

As Kevin suggested, it's been discussed earlier.
If you still need some explanation, here you go -

In COBOL1 program, add a step in the end to READ the output file you mentioned. If the number of records read is zero
Code:
MOVE 4 TO RETURN-CODE ELSE MOVE 0 TO RETURN-CODE
.

RETURN-CODE is a special register used to pass a return code from sub programs to main program and it has a definition of GLOBAL PIC S9(4) COMP VALUE 0.

In the JCL, you put a condition such that
Code:
IF (STEP1.RC = 0)
    give STEP2 lines
ENDIF


nice and easy!
Cheers, Twissi
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: Sat Jun 23, 2007 12:23 am    Post subject:
Reply with quote

Hello,

Or possibly add a counter to the code and increment the counter each time you write a record. When the job is finished, you could compare the counter to zero and issue the return-code as suggested by Twissi.
Back to top
View user's profile Send private message
Prabha
Warnings : 2

New User


Joined: 05 Dec 2005
Posts: 79

PostPosted: Sat Jun 23, 2007 11:36 am    Post subject: Re: How to set the return code in cobol for empty output fil
Reply with quote

Many Thanks for all yr help !!!!
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 -> HomeWorks & Requests All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Finding the plan when code compiled u... Ahemad DB2 1 Fri Dec 01, 2017 6:38 pm
No new posts File Tailoring -- Temporary dataset i... samzee71 CLIST & REXX 3 Fri Dec 01, 2017 3:12 am
No new posts Rexx - File tailoring samzee71 CLIST & REXX 10 Thu Nov 30, 2017 10:47 pm
No new posts Strange Code amitc23 COBOL Programming 6 Tue Nov 28, 2017 11:25 am
No new posts Moving a PS file as body of a mail! Vignesh Sid JCL & VSAM 4 Tue Nov 21, 2017 9:23 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us