MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Re execute PROC with IF/THEN statement

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
JCLGuy
Beginner


Joined: 29 Jan 2010
Posts: 4
Topics: 2

PostPosted: Sun Jan 31, 2010 2:37 pm    Post subject: Re execute PROC with IF/THEN statement Reply with quote

Hi all,
My Job card contains a conditional statement which execute the same PROC with different input files according the Job PGM RC.
That PROC has a conditional statement too.
The PROC act like no condition had been set in it.
Does anyone have an explanation ? what should I do to make it works ?
The code :
Code:

//****************
//PROC1 PROC
//****************
//P1 EXEC PGM=...
// IF PROC1.P1.RC=0 THEN
// ..
// ELSE
// ..
// ENDIF
//           PEND
//****************
//*
//STEP1 EXEC PGM=...
// IF (STEP1.RC=1) THEN
//EX1 EXEC PROC1,FILE=&FILE1
// ENDIF
//*
// IF (STEP1.RC=2) THEN
//EX2 EXEC PROC1,FILE=&FILE2
// ENDIF
//*


So, in run time the IF statement in the PROC is always act according the RC from the job card instead of it's internal PGM RC.

Thanks,
Josef.
Back to top
View user's profile Send private message
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Sun Jan 31, 2010 7:11 pm    Post subject: Reply with quote

It worked OK for me. Could you provide some actual runtime details that would show us where it might be failing?
Back to top
View user's profile Send private message
Anuj Dhawan
Intermediate


Joined: 19 Jul 2007
Posts: 298
Topics: 7
Location: Mumbai,India

PostPosted: Mon Feb 01, 2010 5:44 am    Post subject: Reply with quote

is it related to the other thread you started lately, if yes - I believe, you've an answer there.
_________________
Regards,
Anuj
Back to top
View user's profile Send private message
JCLGuy
Beginner


Joined: 29 Jan 2010
Posts: 4
Topics: 2

PostPosted: Mon Feb 01, 2010 11:17 am    Post subject: Reply with quote

Hi,
Thank you all for your replies.
First of all, this subject is not related to my previous thread (even it's look like it at first sight ).
About runtime details, i will try to provide some later.

Thanks again,
Josef
Back to top
View user's profile Send private message
Terry_Heinze
Supermod


Joined: 31 May 2004
Posts: 391
Topics: 4
Location: Richfield, MN, USA

PostPosted: Mon Feb 01, 2010 3:22 pm    Post subject: Reply with quote

I'm confused; why is the step P1 IF statement worded the way it is? Aren't you checking the return code of something that has not yet executed?
_________________
....Terry
Back to top
View user's profile Send private message Send e-mail
Nic Clouston
Advanced


Joined: 01 Feb 2007
Posts: 1075
Topics: 7
Location: At Home

PostPosted: Wed Feb 03, 2010 1:47 am    Post subject: Reply with quote

Terry

The IF tests the return code from the program in step P1. This is coded before the IF statement - only no DD statements have been shown for step P1. For clarity the OP should have coded a comment line between the EXEC and the IF.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group