Home      Mainframe Forum      Mainfarme Tutorials      IBM Manuals      Mainframe Interview Questions      Mainframe Books      IT News     SiteMap     Downloads


     
 
MAINFRAME - TIP OF THE DAY : All available storage is assigned to the job or jobstep, If REGION is coded 0K or 0M

Google
 
Web mainframegurukul.com

Reset Condition Code.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> JCL
  View previous topic :: View next topic  
Author Message
pratik Ranjan
Member


Joined: 21 Jan 2009
Posts: 21
Location: Hyderabad

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed May 06, 2009 2:35 pm    Post subject: Reset Condition Code. Reply with quote

Can we reset the condition code returned by one step in subsequent steps in a JCL?
_________________
Pratik Ranjan.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.

Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed May 06, 2009 4:16 pm    Post subject: Reply with quote

You can use SET command.

Refer following jcl tutorial for IF condition
http://www.mainframegurukul.com/srcsinc/drona/programming/languages/jcl/jcl.chapter10.html

Using that IF condition & SET command you may change the return code. Try it.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
maheshvamsi
Active Member


Joined: 25 Mar 2009
Posts: 52
Location: Banglore

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed May 06, 2009 6:24 pm    Post subject: Reply with quote

We can't set return code of previous step, in the later part of JCL.

I already tried with IF & SET in JCL, It is not working.

Code:
// IF (Step1.RC=12) THEN 
// SET MAXCC=0             
// ENDIF


But, some of my jobs are using set. When I am trying to delete a Vsam dataset by Using IDCAMS, if it not existing i used to get RC=08.

In the same control card, after deletion step if we use IF & Set MAXCC=0, it will set that return RC as 0.

So, I belive we need to use IF & Set in the same step, not in other part of the JCL.

Someone please correct me if I am wrong.
_________________
Thanks

MaheshVamsi
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
MrSpock
Active Member


Joined: 27 Jun 2007
Posts: 273

Answer was approved by Question owner.
Useful Post
1 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed May 06, 2009 7:39 pm    Post subject: Reply with quote

maheshvamsi wrote:
We can't set return code of previous step, in the later part of JCL.


I concur. It can't be done.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
pratik Ranjan
Member


Joined: 21 Jan 2009
Posts: 21
Location: Hyderabad

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu May 07, 2009 12:22 pm    Post subject: Reply with quote

Hi All,

I tried almost all the possibilities related to IF THEN, and SET statements. But it is turning out to be the same answer that we can't reset a condition code of one step in subsequent steps. Please let me know if there is any other way to achieve this.

Thanks.
_________________
Pratik Ranjan.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1631
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu May 07, 2009 9:13 pm    Post subject: Reply with quote

Hi,

No there is no way to do that. Is this
Quote:
Can we reset the condition code returned by one step in subsequent steps in a JCL
an "actual" business requirement or you asked this out of curiosity?
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1631
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu May 07, 2009 9:24 pm    Post subject: Reply with quote

The program that is being executed in a step is the ONLY entity that can control the value of the return-code for that step. Nothing else can influence the value contained in the return-code register for that step.
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
pratik Ranjan
Member


Joined: 21 Jan 2009
Posts: 21
Location: Hyderabad

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri May 08, 2009 11:08 am    Post subject: Reply with quote

No Anuj, Of course it was a business requirement. See the requirement was "to execute a step based on the return code from another step, and at the same time when the job completes, the MAXCC must be zero". I hope the requirement is clear. Please suggest if something can be done.
_________________
Pratik Ranjan.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1631
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Fri May 08, 2009 6:30 pm    Post subject: Reply with quote

pratik Ranjan wrote:
to execute a step based on the return code from another step,
This can be done with COND or IF/THEN/ELSE consturct - I prefer IF/THEN/ELSE consturct though.
Quote:
and at the same time when the job completes, the MAXCC must be zero".
Read about MAXCC, LASTCC in IDCMAS manual.
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
pratik Ranjan
Member


Joined: 21 Jan 2009
Posts: 21
Location: Hyderabad

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed May 13, 2009 11:30 am    Post subject: Reply with quote

Hi Anuj,

Actually i am aware of IF/THEN/ELSE construct. I have used them already. But still the question is the same.
If a step generates some condition code, then based upon that, using IF/THEN/ELSE construct or, COND we can invoke some other step. But after the completion of the job, the job will throw a maxcc code generated by the prior step, and that violates our requirement. That's why i was trying to find out some way to reset the condition code of a step in some other step which is actually invoked based upon the RC from the prior one.
Previously i thought that we can achieve this with the help of SET command, but it's not working out.

Thanks.
_________________
Pratik Ranjan.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Anuj Dhawan
Moderator


Joined: 09 Aug 2008
Posts: 1631
Location: Mumbai, India

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Wed May 13, 2009 12:30 pm    Post subject: Reply with quote

The program that is being executed in a step is the ONLY entity that can control the value of the return-code for that step. Nothing else can influence the value contained in the return-code register for that step -- so if some step has RC not equal to zero then MAXCC can not be zero. On top of mind, just now, I'm not getting if there is way -- I'll check, may be playing around a bit with IDCAMS can work.
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
pratik Ranjan
Member


Joined: 21 Jan 2009
Posts: 21
Location: Hyderabad

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
1 salutes

PostPosted: Wed May 13, 2009 5:26 pm    Post subject: Reply with quote

Anuj,

Actually i better tell you the exact business requirement, so that we can find one or the other solution.
Our job creates a generation of a GDG everyday. Depending upon the input to the job, the genaration may or, may not be empty. So our requirement is that, if at all the genaration is empty, at the end of the job we need to copy data into it from the prior gen.
So i added an IDCAMS step at the end, to check if the new gen is empty, which will set an RC of 4 if the gen is empty. Using IF/THEN/ELSE construct, i tried to execute another copy step, and wanted to reset the RC of 4 to 0 in that step.
Now that this option is ruled out, as a workaround, i tried achieving the same in a single step as below, but i do not know, why it's not working out.

//CHECK EXEC PGM=IDCAMS
//PREVINV DD DSN=PREV GEN
//CURRINV DD DSN=CURR GEN
//SYSPRINT DD SYSOUT=*
//SYSIN DD DATA
PRINT INFILE(CURRINV) COUNT(1)
IF LASTCC NE 0 THEN
REPRO INFILE(PREVINV) OUTFILE(CURRINV)
SET MAXCC=0
/*

In this step, irrespective of the return code value, the REPRO command is getting executed. Though is sets the RC to 0, but its not working for REPRO. Could you please suggest what may be the reason?

Thanks.
_________________
Pratik Ranjan.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
pratik Ranjan
Member


Joined: 21 Jan 2009
Posts: 21
Location: Hyderabad

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu May 14, 2009 9:49 am    Post subject: Reply with quote

Hi,

Does any one have any idea, how it can be done in an easy way?

Thanks.
_________________
Pratik Ranjan.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
pratik Ranjan
Member


Joined: 21 Jan 2009
Posts: 21
Location: Hyderabad

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu May 14, 2009 12:21 pm    Post subject: Reply with quote

Hi,

I have found out a way, and achieved my requirement. I did some changes in the SYSIN card i.e.

//SYSIN DD DATA
PRINT INFILE(CURRINV) COUNT(1)
IF LASTCC EQ 0 THEN CANCEL
REPRO INFILE(PREVINV) OUTFILE(CURRINV)
SET MAXCC=0
/*

Now it's working fine. But still has not got my answer that in previous case why that IF statement was not working out. Any thoughts??


Thanks.
_________________
Pratik Ranjan.
Back to top
View user's profile Send private message
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Natarajan
Moderator


Joined: 10 Oct 2008
Posts: 537
Location: chennai

Answer was approved by Question owner.
Useful Post
0 votes
Not an useful post
Greate Post!! Salute Author
0 salutes

PostPosted: Thu May 14, 2009 1:22 pm    Post subject: Reply with quote

Thanks Pratik for sharing the information.
_________________
Natarajan
Chennai
Back to top
View user's profile Send private message Visit poster's website
Click here, If this post answer your question. <-- Click on right mark icon. If this post answer your question.
Display posts from previous:   
Post new topic   Reply to topic    mainframegurukul.com Forum Index -> JCL All times are GMT + 5 Hours
Goto page 1, 2  Next
Page 1 of 2



 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

Related topics
 Topics   Replies   Author   Views   Last Post 
No new posts To copy a load module mem from one pds to another thru rexx 6 meena_cts 12569 Mon Feb 01, 2016 10:55 pm
academyindia4 View latest post
No new posts Control flow from one STEP to another 9 pkaushi 29496 Mon Feb 01, 2016 10:55 pm
academyindia4 View latest post
No new posts Copy GDG to GDG (one to one). 6 arrbee 20212 Mon Feb 01, 2016 10:54 pm
academyindia4 View latest post
No new posts CICs 7 vidhya 22155 Mon Feb 01, 2016 10:47 pm
academyindia4 View latest post
No new posts A Really Nice One. Don't Miss the Moral. 0 arrbee 8147 Thu Mar 09, 2006 7:51 pm
arrbee View latest post
 


Cobol Tutorial
This cobol tutorial covers most of the important topics like STRING, UNSTRING, COMP, COMP-3.....
DB2 Tutorial
DB2 Tutorial focuses on DB2 COBOL Programming. Explains in simple language. Some Chapters are locked, Forum members have free access to these chapters
CICS Tutorial
This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming...
JCL Tutorial
This is most popular JCL tutorial from mainframegurukul. It does contain important jcl ....
SORT Tutorial
This Tutorial covers all important aspects of DFSORT. Has more SORT examples
INTERVIEW Questions
This page covers important interview questions
Mainframe Jobs
Mainframe Jobs posted by members of mainframegurukul forum
FaceBook Page
MainframeGurukul FaceBook Page
LinkedIn Page
MainframeGurkul Linkedin Page

This widget requires Flash Player 9 or better







Go to top of the page
 

Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  DB2 INTERVIEW QUESTIONS ||  COBOL INTERVIEW QUESTIONS  ||  JCL INTERVIEW QUESTIONS ||  JCL2 INTERVIEW QUESTIONS ||  VSAM INTERVIEW QUESTIONS ||  CICS INTERVIEW QUESTIONS  ||  Online tutorials ||  Online ABEND Reference ||  JCL References ||  COBOL References ||  VSAM References ||  Tutorials by Drona Series ||  SQL tutorial ||  BOOKS  ||  SiteMap  ||  Expeditor Tutorial  ||  FILE-AID Tutorial  ||  Changeman Tutorial  ||  COBOL   ||  DB2   ||  JCL  ||  CICS  ||  VSAM  ||  DB2 Interview Questions ( 110 )   || Simple JCL Tutorials  || JCL Tutorial from MainframeGurukul.com   || Simple JCL Tutorial - Chapter1 ;|| Mainframe Forum - Tutorials  || Mainframe Tutorials || Mainframe CICS tutorial|| Mainframe COBOL Tutorial

Drona Educational Forums - Mainframe Cobol DB2 CICS Board
Powered by phpBB

mainframetopic-4048.html