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 

Based on Input needs to execute steps availbe in JCL

 
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
prasanth_thavva
Beginner


Joined: 14 May 2006
Posts: 40
Topics: 18

PostPosted: Wed Apr 18, 2007 9:51 am    Post subject: Based on Input needs to execute steps availbe in JCL Reply with quote

Hi,

There are 3 programs: 1, 2 and 3.

Step 1 executes program 1.

Step 2 executes programs 2 & 3.

There is a variable called as
_________________
Thanks&Regards
Prasanth Thavva
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Wed Apr 18, 2007 9:58 am    Post subject: Reply with quote

Quote:

If Option = A, Step I should get executed, else Step 2 should get executed. How do I code this in a JCL using an If-then-else statement? Is there any other method available?


prasanth_thavva,

You can only CHECK numeric values within a IFTHEN in JCL.

Kolusu
_________________
Kolusu
www.linkedin.com/in/kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
superk
Advanced


Joined: 19 Dec 2002
Posts: 684
Topics: 5

PostPosted: Wed Apr 18, 2007 9:58 am    Post subject: Reply with quote

You'll need a program to check the value of OPTION and set a RETURN-CODE value appropriately. Then:

Code:

//* CHECK VALUE OF OPTION. IF IT IS 'A', THEN SET RC=0. ELSE,
//* SET RC=4.
//CHECK EXEC PGM=XXXX,PARM='&OPTION'
//*
// IF (CHECK.RC=0) THEN
//STEP1 EXEC PGM=PROG1
// ELSE
//STEP2 EXEC PGM=PROG2
// ENDIF
Back to top
View user's profile Send private message
Nic Clouston
Advanced


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

PostPosted: Wed Apr 18, 2007 10:03 am    Post subject: Reply with quote

IF-THEN-ELSE is to do with condition code checking, nothing else. You would need a 4th program that would run first - read the otion and set a return code accordingly. Your IF can then use this RC. I presume your 'step' 2 actually executes a procedure consisting of 2 program steps - a step can only execute ione program.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
prasanth_thavva
Beginner


Joined: 14 May 2006
Posts: 40
Topics: 18

PostPosted: Wed Apr 18, 2007 2:08 pm    Post subject: Reply with quote

Hi,

Its working thanks a lot
_________________
Thanks&Regards
Prasanth Thavva
Back to top
View user's profile Send private message Send e-mail
kirank
Beginner


Joined: 21 Apr 2004
Posts: 61
Topics: 33
Location: hyderabad

PostPosted: Wed Oct 24, 2007 3:47 am    Post subject: Reply with quote

Hi SuperK

Could you please let me know after reading the value of OPTION in the program, how to set the RETURN-CODE value appropriately.

Thanks & Regards,
kirank.
Back to top
View user's profile Send private message
Nic Clouston
Advanced


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

PostPosted: Wed Oct 24, 2007 12:23 pm    Post subject: Reply with quote

Kirank

That is a programming question, a new thread and not JCL.

But, seeing as it is now here: Which language are you using because setting the return code varies from language to language?
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
kirank
Beginner


Joined: 21 Apr 2004
Posts: 61
Topics: 33
Location: hyderabad

PostPosted: Thu Oct 25, 2007 12:37 am    Post subject: Reply with quote

Hi

Sorry for the wrong posting.. Here i'm using COBOL. Shall i go ahead and post the question in correct thread.

Thanks
Kirank.
Back to top
View user's profile Send private message
vkphani
Intermediate


Joined: 05 Sep 2003
Posts: 483
Topics: 48

PostPosted: Thu Oct 25, 2007 12:59 am    Post subject: Reply with quote

kiran,

Check the below links.
http://www.mvsforums.com/helpboards/viewtopic.php?t=2059&highlight=set+returncode
http://www.mvsforums.com/helpboards/viewtopic.php?t=995&highlight=set+returncode
Back to top
View user's profile Send private message Send e-mail
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Thu Oct 25, 2007 2:13 am    Post subject: Reply with quote

Hi all,

I have a suggestion to control step-execution:

Quote:

There are 3 programs: 1, 2 and 3.

Step 1 executes program 1.

Step 2 executes programs 2 & 3.

There is a variable called as
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
Back to top
View user's profile Send private message
Nic Clouston
Advanced


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

PostPosted: Thu Oct 25, 2007 1:53 pm    Post subject: Reply with quote

If you did that - why not just have one file? Put data into it if OPTION is A otherwise just open/close it. IDCAMS reads it and it is either populated or empty and the return code is set accordingly. But you still have to have a program that reads the option so why complicate things with extra files? Just set the RC dependent on the option value.
_________________
Utility and Program control cards are NOT, repeat NOT, JCL.
Back to top
View user's profile Send private message
vivek1983
Intermediate


Joined: 20 Apr 2006
Posts: 222
Topics: 24

PostPosted: Fri Oct 26, 2007 1:56 am    Post subject: Reply with quote

Nic Clouston,

Quote:

But you still have to have a program that reads the option so why complicate things with extra files? Just set the RC dependent on the option value.



Yep ! I agree !!
_________________
Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay)
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