Writing to 2 DD names that point to the same datset



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

Writing to 2 DD names that point to the same datset

Postby steve-myers » Mon Jul 26, 2010 4:35 pm

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
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

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

 

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

Postby Bill Dennis » Mon Jul 26, 2010 7:02 pm

If the DISP is MOD and the DDs are opened/closed serially then it should be OK, right?
Regards,

Bill Dennis

Disclaimer: My comments on this forum are my own and do not represent the opinions or suggestions of any other person or business entity.
Bill Dennis
 
Posts: 278
Joined: Thu May 15, 2008 9:45 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby steve-myers » Tue Jul 27, 2010 10:17 am

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.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post