MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

If number of input files vary...

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL)
View previous topic :: View next topic  
Author Message
rasprasads
Beginner


Joined: 10 Dec 2002
Posts: 59
Topics: 20
Location: Chennai

PostPosted: Thu Dec 12, 2002 9:18 am    Post subject: If number of input files vary... Reply with quote

I have to create a jcl for a program.

The number of input files may vary for each run(In the range of 10-30).
Output file is only one.

How should i proceed?(I have no idea on writing the JCL as well as the program for this)So please help...

Thanks

RasprasadS
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Dec 12, 2002 9:48 am    Post subject: Reply with quote

Rasprasad,

You can create dynamic jcl based on your input files and then submit the job to INTRDR.I can give the JCL to create the dynamic jcl.

Will the input file names be in a file ?? where do you get them from??

let me know the details and I will post the solution for you

Kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
rasprasads
Beginner


Joined: 10 Dec 2002
Posts: 59
Topics: 20
Location: Chennai

PostPosted: Thu Dec 12, 2002 10:14 am    Post subject: Reply with quote

The file names are in the format :

T.JOB001RR.R0010.OUTPUT

There are a set of jobs(JOB001RR to JOB050RR) that create these files.
The problem is that the the last 20 jobs may run or may not during the stream...


Thanks for your quick response...
RasprasadS
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12375
Topics: 75
Location: San Jose

PostPosted: Thu Dec 12, 2002 10:57 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Job Control Language(JCL) All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group