|
View previous topic :: View next topic
|
| Author |
Message |
sheersh
New User

Joined: 24 May 2008 Posts: 17 Location: Gurgaon
|
|
|
|
Hi, We are having strange behavior of temp dataset. when temp dataset with same name is allocated more than once without deleting, system is not giving JCL error and later use of temp dataset is causing unpredictable reference to data. for ex.
JSTEP010.STEP010 create &&TEMP1 (DISP=NEW,PASS)
JSTEP010.STEP020 read &&TEMP1 with DISP=SHR (&&TEMP1 is not deleted)
JSTEP020.STEP010 create &&TEMP1 (DISP=NEW,PASS)
JSTEP020.STEP020 read &&TEMP1 - this may pick up the &&TEMP1 dataset created in JSTEP010.STEP010 which is not intended.
Can someone please explain this behavior? |
|
| Back to top |
|
 |
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
I prepared and ran this job, which roughly duplicates the job described in the first post.
| Code: |
//PROC1 PROC
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT2 DD DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1)),DSN=&&TEMP1
//STEP020 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=SHR,DSN=&&TEMP1
//SYSUT2 DD SYSOUT=*
//SYSIN DD DUMMY
// PEND
//PROC2 PROC
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT2 DD DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1)),DSN=&&TEMP1
//STEP020 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=(OLD,DELETE),DSN=&&TEMP1
//SYSUT2 DD SYSOUT=*
//SYSIN DD DUMMY
// PEND
//JSTEP010 EXEC PROC1
//SYSUT1 DD *
TEMP DATA SET CREATED IN JSTEP10
//JSTEP020 EXEC PROC2
//SYSUT1 DD *
TEMP DATA SET CREATED IN JSTEP20
|
I got the same result - I think - described in the first post. In other words, the SYSUT2 data set in JSTEP020.STEP020 contains the text TEMP DATA SET CREATED IN JSTEP10.
Looking at the run output, notice this message -
STMT NO. MESSAGE
13 IEF648I INVALID DISP FIELD- PASS SUBSTITUTED
where stmt 13 is
13 ++SYSUT1 DD DISP=SHR,DSN=&&TEMP1
Now, when you get to JSTEP020/STEP020 there are two data sets in the passed data set queue: the &&TEMP1 from JSTEP010 and the &&TEMP1 from STEP010 in JSTEP020. It picked the first one. This is the behavior I would expect. Nothing strange about it. |
|
| Back to top |
|
 |
Robert Sample
Global Moderator

Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
The MVS JCL Reference manual says:
| Quote: |
| To ensure that a temporary data set name is unique, do not code a temporary data set name. Allow the system to assign one. |
So the behavior you're seeing is expected and normal.
Furthermore, there is an option SYSTEM TEMPDSFORMAT(UNIQUE) in PARMLIB member ALLOCxx that enables allocation to use a more unique format for DSN=&&dsn names. You might want to talk to your site support group about that option. |
|
| Back to top |
|
 |
dneufarth
Active User

Joined: 27 Apr 2005 Posts: 420 Location: Inside the SPEW (Southwest Ohio, USA)
|
|
|
|
| What system names were generated/referenced for the &&TEMP1 datasets at each step in the job? |
|
| Back to top |
|
 |
steve-myers
Active Member
Joined: 30 Nov 2013 Posts: 917 Location: The Universe
|
|
|
|
You can see the data set names in the SYSMSGS data set.
As Mr. Sample says, you can persuade the system to generate fully unique names, but then there is the problem of retrieving the names. In terms of the initial request, the JCL becomes
| Code: |
//PROC1 PROC
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT2 DD DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1))
//STEP020 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=SHR,DSN=*.STEP010.SYSUT2
//SYSUT2 DD SYSOUT=*
//SYSIN DD DUMMY
// PEND
//PROC2 PROC
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN DD DUMMY
//SYSUT2 DD DISP=(,PASS),UNIT=SYSDA,SPACE=(TRK,(1,1))
//STEP020 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DISP=(OLD,DELETE),DSN=*.STEP010.SYSUT2
//SYSUT2 DD SYSOUT=*
//SYSIN DD DUMMY
// PEND
//JSTEP010 EXEC PROC1
//SYSUT1 DD *
TEMP DATA SET CREATED IN JSTEP10
//JSTEP020 EXEC PROC2
//SYSUT1 DD *
TEMP DATA SET CREATED IN JSTEP20 |
Often, though, you have to use names, as in the infamous &&GOSET(GO)). One of my mentors when I was starting out ran multiple step FORTGCLG jobs, and we had to remember to delete the @#%$ data set between the job steps. |
|
| Back to top |
|
 |
sheersh
New User

Joined: 24 May 2008 Posts: 17 Location: Gurgaon
|
|
|
|
| Thanks all for insight. It was really helpful. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|