IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Temp dataset unusual behavior


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sheersh

New User


Joined: 24 May 2008
Posts: 17
Location: Gurgaon

PostPosted: Tue May 08, 2018 9:52 pm
Reply with quote

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
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Wed May 09, 2018 12:40 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Wed May 09, 2018 1:19 am
Reply with quote

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
View user's profile Send private message
dneufarth

Active User


Joined: 27 Apr 2005
Posts: 419
Location: Inside the SPEW (Southwest Ohio, USA)

PostPosted: Wed May 09, 2018 2:40 am
Reply with quote

What system names were generated/referenced for the &&TEMP1 datasets at each step in the job?
Back to top
View user's profile Send private message
steve-myers

Active Member


Joined: 30 Nov 2013
Posts: 917
Location: The Universe

PostPosted: Wed May 09, 2018 5:48 am
Reply with quote

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
View user's profile Send private message
sheersh

New User


Joined: 24 May 2008
Posts: 17
Location: Gurgaon

PostPosted: Wed May 09, 2018 9:59 am
Reply with quote

Thanks all for insight. It was really helpful.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts Allocated cylinders of a dataset DB2 12
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
Search our Forums:

Back to Top