IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Execute only those steps for which the input file exist


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Global Moderator


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

PostPosted: Fri Jun 27, 2008 12:51 pm
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: 8797
Location: Welsh Wales

PostPosted: Fri Jun 27, 2008 1:51 pm
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

Senior Member


Joined: 08 May 2006
Posts: 1193
Location: Dublin, Ireland

PostPosted: Fri Jun 27, 2008 3:08 pm
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
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: 1702
Location: Australia

PostPosted: Sat Jun 28, 2008 6:27 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top