Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating an allocation with variable DSN (on zOS) 1

Status
Not open for further replies.

oucheeeeee

Technical User
Jul 8, 2008
9
Hi,

I'm trying to find out if it is possible to create a DSN allocation dependent on a variable?

I need to backup a VSAM file but want to back it up to it's own GDG not just a generic GDG.

IE
I have a ring of journals that cycle round each day. The files are called,

let's say ABC.P40JRx (where x is 1 - 5)
I also have ABC.A40JRx (alternate file for 40's)
ABC.P99JRx
ABC.A99JRx (alternate file for 99's)

each day, the journal ring rolls round by 1 and when this happens, before DEL/DEF the new journal, I want to create a backup. This is a simple task if I just want to write it to a generic GDG, say ABC.JRNL.BKP(+1).

However, I would like to create the backups and allocate them to the same name (but with .BKP appended)

Unfortunately, there is no way of knowing which of the 20 possible journals will have been used.

When the JCL runs, the program uses (I assume) C++ to create a SYSIN card pointing to the correct IDCAMS library member (P40JR3 will del/def ABC.P40JR3) - This is NOT done via PARM= or by using symbolics (as in a JCL Proc).

How can I take that value (provided in the JCL at runtime) and use it to create an allocation for ABC.P40JR3.BKP(+1)

My current thinking is to create the backup (a seq file from REPRO of VSAM journal) to ABC.JRNL.BKP using either OUTFILE or OUTDATASET and then PASS this new dataset to a second step where it can be written to the correct GDG (IE copy this ABC.JRNL.BKP to ABC.P40JR3.BKP(+1) obv. dependant on which journal is being backed up). To find which journal was used, I was planning to write the SYSPRINT for the first step to a file, then, in the next step, use REXX to strip out the correct journal name. It's fairly easy for me to do a 'say VALUE' where VALUE = the journal name. How can I move that VALUE to a PARM or a DSN?

This would also be simple if you could dynamically allocate a GDG using ALLOCATE or OUTDATASETNAME but you must specify an actual generation number (you can't use +1).

Anyone got any ideas on how I might achieve this?

Many thanks,

Regards,

Rob
 
Try something like this:

//TESTJOB JOB (DEFKSDS),.....
//*
//******************************************************************
//* IDCAMS REPRO, DELETE. DEFINE CLUSTER TST1.CLUSTER.NAME
//******************************************************************
//DEFINE EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD DISP=SHR,DSN=SYSPH1.JCL.LIB(IDCAMSIN)
//SEQOUT DD DSN=SEQ.COPY.CLUSTER.NAME,DISP=.....
//*
//******************************************************************
//* COPY INPUT TO .BKP(+1)
//******************************************************************
//COPY EXEC PGM=IKJEFT1B,REGION=0M,DYNAMNBR=50,PARM='%TSTCOPY'
//SYSEXEC DD DISP=SHR,DSN=REXX.LIB
//DDDEF DD DISP=SHR,DSN=*.DEFINE.SYSIN
//DDIN DD DSN=SEQ.COPY.CLUSTER.NAME,DISP=SHR
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSTSIN DD DUMMY
//

/* REXX */
/* ***************************************************** */
/* DDdef is the name of the DD statement that points to the IDCAMS */
/* Delete / Define */
/* //DDDEF DD DISP=SHR,DSN=*.DEFINE.SYSIN */
/* DDIN is the name of the DD statement that points to the COPY */

Data. = ''
Data.0 = 0

/* Parse the dataset name from the Delete statement */
/* ie DELETE TST1.CLUSTER.NAME PURGE CLUSTER */

'EXECIO * DISKR DDdef (STEM Defin. FINIS'
Do i = 1 to Defin.0
If pos('DELETE',Defin.i) > 0 then
Do
parse var Defin.i . 'DELETE' DSNname . /* DOTS */

leave
End
End
DSNname = strip(DSNname,'B')
DSNout = DSNname'.BKP(+1)'

attrb = 'TRACKS SPACE(500,300) RELEASE UNIT(SYSDA) ',
'RECFM(F,B) LRECL(080) '
AllocOut = "ALLOC DSN('"DSNout"') DD("DDout") NEW CATALOG" attrb "GDGNT"
RC = BPXWDYN(AllocOut)
If RC <> 0 then Call Exit8 'Error Allocating' DSNout

'EXECIO * DISKR DDin (STEM Data. FINIS'
If RC <> 0 then Call Exit8 'Error Reading' DSNin

'EXECIO' Data.0 'DISKW DDout (STEM Data. FINIS'
If RC <> 0 then Call Exit8 'Error Writing' DSNout

RC = BPXWDYN('FREE dd(DDout)')
exit 0

/* ********** REXX Error Exit ********** */
Exit8:
Arg ErrMsg
Say Errmsg
If Datatype(S99msg.0,'N') then
Do i = 1 to S99msg.0
say S99msg.i
End
Exit 08
/* */

 
Many thanks for the response. I tried the code this morning and although i couldn't get it to create the correct GDG (dynamic allocation wouldn't allow for anything than ABSOLUTE generation) it did lead me further down the path to glory (well - to appease my jefe).



As of right now - the system knows which IDCAMS statement (repro/del/def) to run for the appropriate journal. THAT means that I can write the repro out to ABC.P40JR3.BKP.TMP via the dynamic allocation. Then, read the sysprint to see which journal was used (I can see that from the //SYSIN member. REXX routine to strip out the journal, that fires off another job. As the other job can be different for each file, I can hardcode the Journal backup GDG in that JCL. The rexx simply selects WHICH member (and by extention JOB to use).

Again, many thanks for your help

Rob
 
BPXWDYN should be able to do dynamic allocation of a GDG.
What error message did you get?
Rather than reading the sysprint my example read the input of the delete / define step to get the name of the temp backup file.
 
I didn't respond yesterday because RxUsr nailed it with BPXWDYN.

If BPXWDYN is not doing the trick, you have other errors getting in the way. Fix those.

Frank Clarke
--America's source for adverse opinions since 1943.
 
RxUSR certainly DID nail it - When I went back in to check (must admit, I sort of benched this as I thought my other plan would work perfectly well) the allocation error was my own fault as I was trying to copy a VB file into an FB backup.

As soon as I rectified this, the routine worked a charm.

Don't want to gush...........but thanks!

Does exactly what it says on the post. We're cooking with GAS.

Cheers,

Rob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top