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
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
This topic is locked: you cannot edit posts or make replies. How to pass the previous month date i... Suganya87 DFSORT/ICETOOL 5 Mon Oct 31, 2016 4:13 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm
This topic is locked: you cannot edit posts or make replies. Job to wait and continue based on reply yugendran COBOL Programming 5 Wed Oct 05, 2016 1:46 pm


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