How to give file names dynamically in DD statements.



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

How to give file names dynamically in DD statements.

Postby mathew28 » Mon Jun 27, 2011 12:47 pm

Hi,

I have a set of 100 files which gets archived. The format of the DSN is ABC.D<YYMM>.TEST
Only the <YYMM> part changes in the file names.
The file name ABC.D*.TEST in the list option displays all the 100 files. These files gets migrated after a certain period.

My requirement is to run a job to refresh all these file from the archive to recall it.

So, how this could be done. Kindly give your suggestions.

For a single file with following worked:

//STEP2 EXEC PGM=IEBGENER,COND=(0,NE,STEP1)
//SYSUT1 DD DSN=ABC.D0101.TEST,
// DISP=(OLD,CATLG)
//SYSUT2 DD DUMMY
//SYSIN DD *
/*

In STEP1, I checked the availability of the file 'ABC.D0101.TEST' using the LISTCAT option.

1. How this can be done for all the 100 files ?
2. Can a looping be done with symbolics changing the file name in STEP2 ?
3. Can the file names be extracted from the LISTCAT output and used in STEP2?

4. Another option available is to use the HRECALL command in the job. But, the issue faced is, if the file is not migrated and if it exists. An error message is thrown.
Also this could be done for one file. How to do it for all the 100 files ?

With the above queries, please help me out. Thanks in advance.
mathew28
 
Posts: 30
Joined: Tue Oct 20, 2009 11:06 am
Has thanked: 0 time
Been thanked: 0 time

Re: How to give file names dynamically in DD statements. Pls

Postby Robert Sample » Mon Jun 27, 2011 3:30 pm

1. There is no looping facility in JCL.

2. Once submitted and passed through the converter / interpreter, the JCL cannot be changed.

3. Why not use HRECALL with a wild card? The error message doesn't matter.

4. Have you discussed this process with your storage management group? You are attempting to pervert the storage management policies of your site and they rarely like that.

5. Is this a one-time thing or are you planning on doing this regularly? If a one-time thing, just manually look at all 100 data sets and issue HRECALL commands if appropriate. If you plan on doing this regularly (and discussed doing so with your storage management group), see if the storage management group has anything to help. If not, write a program in the language of your choice to parse the output of LISTCAT (or whatever you wind up using to get this data) and generate the JCL. Submit the final JCL to the internal reader.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: How to give file names dynamically in DD statements. Pls

Postby steve-myers » Mon Jun 27, 2011 11:14 pm

Just a few comments on Mr. Sample's post.
Robert Sample wrote:1. There is no looping facility in JCL.
True.

Robert Sample wrote:2. Once submitted and passed through the converter / interpreter, the JCL cannot be changed.
True.

Robert Sample wrote:3. Why not use HRECALL with a wild card? The error message doesn't matter.
HRECALL with a wild card and the WAIT parameter.

Robert Sample wrote:4. Have you discussed this process with your storage management group? You are attempting to pervert the storage management policies of your site and they rarely like that.
True.

Robert Sample wrote:5. Is this a one-time thing or are you planning on doing this regularly? If a one-time thing, just manually look at all 100 data sets and issue HRECALL commands if appropriate. If you plan on doing this regularly (and discussed doing so with your storage management group), see if the storage management group has anything to help. If not, write a program in the language of your choice to parse the output of LISTCAT (or whatever you wind up using to get this data) and generate the JCL. Submit the final JCL to the internal reader.
I have a similar program that OPENs every dataset in a LISTCAT output just to update the referenced date, just to cheat storage management. But something like this is not a very good idea.

If you truly need a dynamic DD you most likely need to use Assembler and dynamic allocation. You let dynamic allocation assign the DD name, tell dynamic allocation to return the DD name, and you can go from there.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: How to give file names dynamically in DD statements. Pls

Postby prino » Tue Jun 28, 2011 1:52 am

steve-myers wrote:... If you truly need a dynamic DD you most likely need to use Assembler and dynamic allocation. You let dynamic allocation assign the DD name, tell dynamic allocation to return the DD name, and you can go from there.

The latest versions of Enterprise PL/I can also do dynamic allocation, and I think there are also ways of doing dynamic allocation with Cobol.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 635
Joined: Wed Mar 11, 2009 12:22 am
Location: Vilnius, Lithuania
Has thanked: 3 times
Been thanked: 28 times

Re: How to give file names dynamically in DD statements.

Postby Robert Sample » Tue Jun 28, 2011 3:03 am

BPXWDYN is an IBM-supplied program that allows COBOL programs (or others) to dynamically allocate files.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: How to give file names dynamically in DD statements.

Postby steve-myers » Tue Jun 28, 2011 5:38 am

To the two Roberts - I'm aware of BPXWDYN, but I'm not sure if there is a mechanism in it to do a dynamic allocation, and return the DD name that was allocated to the caller. Granted, the program can define a series of BPXnnnnn DD names (to use an example), which would amount to the same thing.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: How to give file names dynamically in DD statements.

Postby Robert Sample » Tue Jun 28, 2011 6:29 am

I've used BPXWDYN in a COBOL program to dynamically allocate a data set to a DD name. That DD name had a SELECT in the COBOL program. The file was opened, the data was input, and the file was closed -- and the only DD statements in the execution job were STEPLIB and SYSOUT for the COBOL DISPLAY statements.
Robert Sample
Global moderator
 
Posts: 3719
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post