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
 

 

Execute only those steps for which the input file exist

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

New User


Joined: 24 Mar 2008
Posts: 8
Location: Bangalore

PostPosted: Fri Jun 27, 2008 11:21 am    Post subject: Execute only those steps for which the input file exist
Reply with quote

I need to prepare a job with approx 30 steps.Each step has an input dsn and an output dsn. I need to excute only those steps for which the input file exist and is not empty.

Is it possible to do so? I believe if the file doesn't exist then it gives jcl error and doesn't even execute the job.
Back to top
View user's profile Send private message

superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4648
Location: Raleigh, NC, USA

PostPosted: Fri Jun 27, 2008 12:51 pm    Post subject: Reply to: Query on Jcl
Reply with quote

Nothing easy comes to mind. The only thing I can think of is that you'd have to write a program that would examine all of the required datasets and determine if they exist and if they are or aren't empty. Then, based on those statuses, it would create a custom job that includes only the valid datasets.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Jun 27, 2008 1:51 pm    Post subject:
Reply with quote

Or use a REXX program to determine if the dataset exists and is populated, set a zero RC if all OK, else RC = 4

Unfortunately for every dataset icon_confused.gif
Back to top
View user's profile Send private message
Garry Carroll

Active Member


Joined: 08 May 2006
Posts: 992
Location: Dublin, Ireland / Edinburgh, Scotland

PostPosted: Fri Jun 27, 2008 3:08 pm    Post subject:
Reply with quote

You could use an initial IEFBR14 step which specifies DISP=(MOD,CATLG) for the datasets together with necessary SPACE & DCB information. This will ensure that they at least exist for the following steps so you don't get JCL error. If they exist with or without data they will remain unchanged. If not, they will be created as empty files.

Next, insert steps to use DFSORT/ICETOOL to determine the count of records and set condition code 4 or 12 if empty. If the cond code for a dataset is zero, execute the step, else bypass.

Hopes this helps,
Garry.
Back to top
View user's profile Send private message
amalraj_ece

New User


Joined: 16 Jul 2006
Posts: 21
Location: delhi

PostPosted: Sat Jun 28, 2008 2:24 am    Post subject: Reply to: Execute only those steps for which the input file
Reply with quote

Code:
//AMALTEST JOB ,,CLASS=S,REGION=0M,NOTIFY=&SYSUID           
//STEP1    EXEC PGM=IDCAMS                                 
//SYSPRINT DD SYSOUT=*                                     
//DUMMY1   DD DUMMY,DCB=(RECFM=FBA,LRECL=81,BLKSIZE=8100), 
//            SPACE=(TRK,(10,5),RLSE)                       
//DD2      DD DSN=AMAL.FILE.GDG(+1),                       
//            DISP=(NEW,CATLG,DELETE),                     
//            DCB=(RECFM=FBA,LRECL=81,BLKSIZE=8100),       
//            SPACE=(TRK,(10,5),RLSE)                       
//SYSIN DD *                                               
  PRINT INDATASET(AMAL.FILE.TEST1) COUNT(1)                 
  IF LASTCC = 0 THEN -                                     
     REPRO INDATASET(AMAL.FILE.TEST1) OUTFILE(DD2)         
  ELSE DO                                                   
     SET MAXCC = 0                                         
     REPRO INFILE(DUMMY1) OUTFILE(DD2)                     
/*                                                         
//                           


try to enhance this jcl to get your actual result
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Sat Jun 28, 2008 6:27 am    Post subject:
Reply with quote

Hi,
I would add an additional 30 steps, 1 for every file and test it's existence and emptyness either by a REXX as EXPAT mentioned or IDCAMS as AMAL mentioned but only

Code:
PRINT INDATASET(AMAL.FILE.TEST1) COUNT(1)   


If it returns a 0 then file exists with data, if it retuns a 4 it exists and is empty and if it returns a 12 it doesn't exist.

Now each copy step should run when previous step returns a 0 retun code.


Gerry
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 Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 3 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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