Page 1 of 1

Writing to 2 DD names that point to the same datset

PostPosted: Mon Jul 26, 2010 4:35 pm
by steve-myers
There was a topic somwhere on these boards where there was JCL something like this -
//A       EXEC PGM=IKJEFT01
//SYSTSPRT DD  DISP=MOD,DSN=a.dataset
//SYSPRINT DD  DISP=MOD,DSN=a.dataset
//SYSTSIN  DD  *
TSO commands that (I think) invoke DB2 functions
I can't find this topic any more, and I realized that we had all missed the key point. The problem is there was nothing in a.dataset.

The key point is this is not something you can do in OS/360 type systems. The first write in SYSPRINT will wipe out anything in a.dataset written to SYSTSPRT (since that is the most likely sequence). What you have to do is something like this -
//A       EXEC PGM=IKJEFT01
//SYSTSPRT DD  DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1)),
//             DCB=(RECFM=FBA,LRECL=133,DSORG=PS)
//SYSPRINT DD  DISP=(,PASS),UNIT=SYSDA,SPACE=(CYL,(1,1)),
//             DCB=(RECFM=FBA,LRECL=133,DSORG=PS)
//SYSTSIN  DD  *
TSO commands that (I think) invoke DB2 functions
//B       EXEC PGM=IEBGENER
//SYSPRINT DD  SYSOUT=*
//SYSUT1   DD  DISP=OLD,DSN=*.A.SYSTSPRT
//         DD  DISP=OLD,DSN=*.A.SYSPRINT
//SYSUT2   DD  DISP=MOD,DSN=a.dataset
//SYSIN    DD  DUMMY

Re: Writing to 2 DD names that point to the same datset

PostPosted: Mon Jul 26, 2010 7:02 pm
by Bill Dennis
If the DISP is MOD and the DDs are opened/closed serially then it should be OK, right?

Re: Writing to 2 DD names that point to the same datset

PostPosted: Tue Jul 27, 2010 10:17 am
by steve-myers
Mr. Dennis is 100% correct, but it's not likely to be valid for the JCL I posted, since SYSTSPRT is opened before the first command is processed and closed after the last command completes, where SYSPRINT is presumably opened and closed (possibly more than once) while the commands in SYSTSIN are being processed. If SYSPRINT is opened and closed multiple time, then the JCL for SYSPRINT should specify DISP=(MOD,PASS) rather than the DISP=(NEW,PASS) that I used.