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
 

 

[Solved]Execution of particular steps based on Condition

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
kiran.v2

New User


Joined: 29 Jul 2005
Posts: 10

PostPosted: Thu Aug 04, 2005 10:29 am    Post subject: Execution of particular steps based on Condition
Reply with quote

Hi All,

In my JCL i have 10 Steps, in 3rd Step i am writing into the file,

If that file is empty i want to Execute 4th step other wise i want to execute 6th step.


Pls give me the code...



Regards,
Murali.
Back to top
View user's profile Send private message

shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Thu Aug 04, 2005 11:34 am    Post subject: Re: Execution of particular steps based on Condition
Reply with quote

Hi Murali,

1. Use COND code

2. Explicit IF condtion

Both will do ur reqmnt

Like...for first one

In step3, if nothing is written in outfile, pass value to RC (Return-code). Based on the RC, execute step4 else skip 4&5
Back to top
View user's profile Send private message
kiran.v2

New User


Joined: 29 Jul 2005
Posts: 10

PostPosted: Thu Aug 04, 2005 12:18 pm    Post subject:
Reply with quote

Hi Muthu,

Can u tell me how to pass values to RC.


Regards,
Murali.
Back to top
View user's profile Send private message
shivashunmugam Muthu

Active User


Joined: 22 Jul 2005
Posts: 114
Location: Chennai

PostPosted: Thu Aug 04, 2005 1:45 pm    Post subject: Re: Execution of particular steps based on Condition
Reply with quote

You can pass the value as

MOVE XXXX TO RETURN-CODE

RC - 4 byte cobol system variable. this statement can be coded with any conditional statement
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Thu Aug 04, 2005 4:10 pm    Post subject: Re: Execution of particular steps based on Condition
Reply with quote

Hi Murali,
Quote:
In my JCL i have 10 Steps, in 3rd Step i am writing into the file,

If that file is empty i want to Execute 4th step other wise i want to execute 6th step.

If you are willing for a JCL way....Code an IDCAMS step after 3rd step which checks for empty file....& returns 4 in case of empty....

Then by IF conditions or COND parm you can execute steps as per ur requirements......

Regards,

Priyesh.
Back to top
View user's profile Send private message
murali1508

New User


Joined: 28 Jul 2005
Posts: 5

PostPosted: Fri Aug 05, 2005 12:32 pm    Post subject: Re: Execution of particular steps based on Condition
Reply with quote

Hi Priyesh,

Can u write that IF or COND Statement.


murali...
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Aug 05, 2005 1:05 pm    Post subject: Re: Execution of particular steps based on Condition
Reply with quote

Code:
//STEP3
FILE IS BEING WRITTEN
//
//STEP0  EXEC PGM=IDCAMS                             
//IN   DD DSN=FILE TO BE CHEKCED,DISP=SHR   
//SYSPRINT DD SYSOUT=*                               
//SYSIN    DD DATA                                   
   PRINT INFILE(IN) COUNT(1)                         
/*                                                   
//IFSTEP4#  IF (STEP0.RC=4) THEN 
//STEP4,
//STEP5
//ENDSTEP4# ENDIF
//STEP6
//


Here I have assumed you want to skip STEP4 & STEP5 in case the file having records....as u said
Quote:
If that file is empty i want to Execute 4th step other wise i want to execute 6th step.


If any doubt...get me back...

Regards,

Priyesh.
Back to top
View user's profile Send private message
murali1508

New User


Joined: 28 Jul 2005
Posts: 5

PostPosted: Fri Aug 05, 2005 2:09 pm    Post subject:
Reply with quote

Hi Priyesh,

I tried with u r Code it is Fine

Thank u Priyesh........


Murali.
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm
No new posts Joinkeys with condition scdinesh DFSORT/ICETOOL 10 Tue Feb 14, 2017 12:20 am


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