View previous topic :: View next topic
|
Author |
Message |
devagarwal
New User
Joined: 24 Mar 2008 Posts: 8 Location: Bangalore
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
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 |
|
Back to top |
|
|
Garry Carroll
Senior Member
Joined: 08 May 2006 Posts: 1193 Location: Dublin, Ireland
|
|
|
|
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 |
|
|
amalraj_ece
New User
Joined: 16 Jul 2006 Posts: 21 Location: delhi
|
|
|
|
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 |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
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 |
|
|
|