VSAM file is allocated to another job or user



Help for IBM's record-oriented filesystem VSAM, ESDS, KSDS, RRDS, LDS and Storage management Subsystems

Re: VSAM file is allocated to another job or user

Postby Robert Sample » Sun Jul 11, 2010 8:50 pm

I am sure that my dataset was not opened any where even then the failure message says" DATASET IN USE".
Given the choice between your sureness and the system message, I will 100% of the time believe the system over you -- sorry but the system just has no reason to lie about this. Could you have the data set open in ISPF (browse or edit)? That would cause "DATASET IN USE" messages.

Why not take the simple way out and just include a DD statement pointing to the file being renamed with DISP=OLD? That way the job won't even start running until the RENAME can succeed. The DD statement does not have to be used in the IDCAMS commands -- it is there merely so the system will grant exclusive access to the data set to your job.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: VSAM file is allocated to another job or user

Postby cvrupesh » Mon Jul 12, 2010 4:13 pm

Hi Robert,

Why not take the simple way out and just include a DD statement pointing to the file being renamed with DISP=OLD?


I am afraid that I didn get what you were trying to suggest me here.
Can you please elaborate on this as I am a beginner to JCL's?

Thanks everyone for your help.
Rupesh.
cvrupesh
 
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM file is allocated to another job or user

Postby Robert Sample » Mon Jul 12, 2010 4:55 pm

//ZZ25TEST JOB 1,'RENAME',MSGCLASS=2,CLASS=Y,NOTIFY=&SYSUID
//*==============================================================
//*%%R S=RENAME1 P=IDCAMS R=*
//*%%C RENAME THE FILE FROM READY TO COMPLETE
//*==============================================================
//*
//RENAME1 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//INFILE   DD DISP=OLD,DSN=ZZ25.READY
//SYSIN DD *
ALTER ZZ25.READY -
NEWNAME (ZZ25.COMPLETE)
//*
The DD statement causes the job to wait until ZZ25.READY can be allocated exclusively, if another job or TSO user has the data set allocated.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: VSAM file is allocated to another job or user

Postby cvrupesh » Mon Jul 12, 2010 5:15 pm

wow...thats fantastic and will resolve my problem...Thanks Robert..
cvrupesh
 
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM file is allocated to another job or user

Postby cvrupesh » Wed Jul 14, 2010 7:15 pm

Hi Robert,

Can I take your time again to ask how actually the INFILE Statement with DISP=OLD makes the job not to fail?

Thanks,
Rupesh.
cvrupesh
 
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM file is allocated to another job or user

Postby NicC » Wed Jul 14, 2010 7:44 pm

DISP=OLD (basic JCL this) means the job wants EXCLUSIVE use of the dataset therefore it will wait until it has exclusive use. Read about DISP in the JCL manual.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: VSAM file is allocated to another job or user

Postby Robert Sample » Wed Jul 14, 2010 10:08 pm

The ALTER command means you must have exclusive access to the dataset. If there is no DD statement for the data set, JES does not "know" you need to use the data set and will not prevent other jobs from running at the same time that use the data set. If you put the DD statement in the job, JES "knows" that your job requires exclusive access to the data set and will not start it until you get that exclusive access.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Re: VSAM file is allocated to another job or user

Postby steve-myers » Thu Jul 15, 2010 7:52 am

Actually JES2 knows nothing about the data sets in your JCL. JES3 does, but not JES2.

JES2 will start your job. Before z/OS actually starts to run your job it gets control of all of the data sets specified in the job's JCL. If some other job is using any of your data sets your job will wait until all of the data sets are available.

A way to specify a data set name that may not actually exist is to code something like this
//MYDS     DD  DISP=OLD,VOL=REF=SYS1.SVCLIB,
//             DSNAME=MY.DATASET.NAME
Data set SYS1.SVCLIB must be cataloged and it must be cataloged on the SYSRES volume, whatever that might be, so this allocation will always go through, even if MY.DATASET.NAME does not actually exist on the SYSRES volume, or even exist. I would suggest you do this for both the old and new data set names in the ALTER NEWNAME control statement.
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: VSAM file is allocated to another job or user

Postby cvrupesh » Thu Jul 22, 2010 1:13 pm

One more doubt on this, please clarify and help me.

When I say the job failed with errors while renaming a flat file using IDCAMS, is it possible for me to check what exactly(job/sms etc..) is using the dataset at the time the IDCAMS tried to rename the dataset from Spool?

The error from current spool looks as below:

IDCAMS SYSTEM SERVICES TIME: 00:31:06

ALTER ZZ25..READY -
NEWNAME (ZZ25.COMPLETE)
IDC3028I DATA SET IN USE
IDC3009I ** VSAM CATALOG RETURN CODE IS 184 - REASON CODE IS IGG0CLEC-4
IDC0532I **ENTRY ZZ25.READY NOT ALTERED
IDC0001I FUNCTION COMPLETED, HIGHEST CONDITION CODE WAS 8

IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 8
Thanks Always,
-Rupesh.
cvrupesh
 
Posts: 20
Joined: Tue Jun 02, 2009 9:59 am
Location: Bangalore
Has thanked: 0 time
Been thanked: 0 time

Re: VSAM file is allocated to another job or user

Postby Robert Sample » Thu Jul 22, 2010 4:42 pm

Ask your site support group about what is available at your site. The CBT web site has a program available called WHOHAS that allows you to go to ISPF 3.4 and put WHOHAS beside the data set to find out everyone currently allocating that data set. There are other tools as well -- but only your site support group will know for sure what is installed at your site.
Robert Sample
Global moderator
 
Posts: 3720
Joined: Sat Dec 19, 2009 8:32 pm
Location: Dubuque, Iowa, USA
Has thanked: 1 time
Been thanked: 279 times

Previous

Return to VSAM/SMS

 


  • Related topics
    Replies
    Views
    Last post