kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Thu Dec 12, 2002 10:57 am Post subject: |
|
|
Rasprasad,
Here is a solution for you. Let us say you have 50 jobs which create 50 datasets.But out of these 50 jobs only 30 jobs ran on a particular day creating only 30 datasets.The program which is reading all these 50 files will abend because it cannot find the 20 files from the jobs which did not run on that particular day.
We add a IEFBR14 step in the program which reads in all the 50 files created with a disp=MOD. By doing so we will do nothing if the dataset exists, but will create an EMPTY dataset if it does not exist.
Code: |
//STEP0010 EXEC PGM=IEFBR14
//*
//FILE01 DD DSN=T.JOB001RR.R0010.OUTPUT,
// DISP=(MOD,KEEP,KEEP),
// UNIT=SYSDA,
// SPACE=(TRK,(1,1),RLSE),
// DCB=(LRECL=ZZZ,RECFM=FB,BLKSIZE=0)
//*
//FILE02 DD DSN=T.JOB002RR.R0010.OUTPUT,
// DISP=(MOD,KEEP,KEEP),
// UNIT=SYSDA,
// SPACE=(TRK,(1,1),RLSE),
// DCB=(LRECL=ZZZ,RECFM=FB,BLKSIZE=0)
.....
//FILE50 DD DSN=T.JOB050RR.R0010.OUTPUT,
// DISP=(MOD,KEEP,KEEP),
// UNIT=SYSDA,
// SPACE=(TRK,(1,1),RLSE),
// DCB=(LRECL=ZZZ,RECFM=FB,BLKSIZE=0)
//*
|
Now concatenate all these 50 files to the ddname of the program reading these files
Code: |
//INPUT DD DISP=SHR,DSN=T.JOB001RR.R0010.OUTPUT
// DD DISP=SHR,DSN=T.JOB002RR.R0010.OUTPUT
.....
// DD DISP=SHR,DSN=T.JOB050RR.R0010.OUTPUT
|
Since all your 50 files exist, the program does not abend.
Now we need to clean up all the empty datasets which we created in the first step.
For that we can use IDCAMS.We use the print command to print 1 line. If the file is empty then it will set the return code to 4. Then use if clause to check the return code and if it is 4 then delete the dataset.
Code: |
//LASTSTEP EXEC PGM=IDCAMS
//*
//SYSPRINT DD SYSOUT=*
//FILE01 DD DSN=T.JOB001RR.R0010.OUTPUT,DISP=SHR
//FILE02 DD DSN=T.JOB002RR.R0010.OUTPUT,DISP=SHR
.....
//FILE50 DD DSN=T.JOB050RR.R0010.OUTPUT,DISP=SHR
//SYSIN DD *
PRINT INFILE(FILE01) CHARACTER COUNT(1)
IF LASTCC = 4 THEN DELETE 'T.JOB001RR.R0010.OUTPUT'
PRINT INFILE(FILE02) CHARACTER COUNT(1)
IF LASTCC = 4 THEN DELETE 'T.JOB002RR.R0010.OUTPUT'
......
PRINT INFILE(FILE03) CHARACTER COUNT(1)
IF LASTCC = 4 THEN DELETE 'T.JOB050RR.R0010.OUTPUT'
/*
|
Hope this helps...
cheers
kolusu |
|