View previous topic :: View next topic
|
Author |
Message |
mrar_160
New User
Joined: 14 Sep 2005 Posts: 48
|
|
|
|
HI all..
I have 1 question, how can i check wheater dataset A is exist or not?
If dataset A is not exist, then proceed the next step.. But the dataset A is exist, the job will stop. |
|
Back to top |
|
|
Bharanidharan
New User
Joined: 20 Jun 2005 Posts: 86 Location: Chennai, India
|
|
|
|
Try this.
Code: |
//JS10 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT ENTRIES('AAA.BBB')
/*
|
IDCAMS will return RC=4 if the dataset AAA.BBB is not available in the catalog. You can then introduce IF... ENDIF or decide to force terminate the job, as the case may be. |
|
Back to top |
|
|
mrar_160
New User
Joined: 14 Sep 2005 Posts: 48
|
|
|
|
Ok, thank..I will try first. |
|
Back to top |
|
|
mrar_160
New User
Joined: 14 Sep 2005 Posts: 48
|
|
|
|
Bharanidharan,
i had tried. How can i list for nonsms dataset??
Is there any parameter i need to insert? |
|
Back to top |
|
|
Bharanidharan
New User
Joined: 20 Jun 2005 Posts: 86 Location: Chennai, India
|
|
|
|
hmm... I never had the blessing of trying out for non-SMS datasets in my system. But you can try this (I didn't test it though):
Code: |
//JS10 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT ENTRIES('AAA.BBB') CATALOG('catlgname/password')
/*
|
where catlgname is the name of the catalog having the entry; password is an optional parameter and must be provided if catalog is password protected.
FYI, the full list of admissible parmaters is:
Code: |
LISTCAT CATALOG('catname/password')
LIBRARY('lib_name')
FILE('dname')
OUTFILE('dname')
LEVEL('level') | ENTRIES('entryname/password' ...) |
LIBRARYENTRIES('library_entryname') |
VOLUMEENTRIES('volume_entryname')
CREATION('nnnn')
EXPIRATION('nnnn')
NOTUSABLE
CLUSTER DATA INDEX ALIAS SPACE NONVSAM
USERCATALOG GENERATIONDATAGROUP PAGESPACE
ALTERNATEINDEX PATH
ALL | NAME | HISTORY | VOLUME | ALLOCATION
|
|
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Hi,
I think this is also another solution
Code: |
//*********************************************************************
//* FILE NOT EXISTING : RC = 12
//* EMPTY FILE : RC = 04
//* DATA FILE : RC = 00
//*********************************************************************
//STEP010 EXEC PGM=IDCAMS
//SYSUDUMP DD SYSOUT=C
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//FILEIN DD DSN=TTYA.TEST.FILE1,DISP=SHR
//SYSIN DD *
PRINT INFILE(FILEIN) -
CHARACTER COUNT(1)
/*
//*
|
|
|
Back to top |
|
|
Bharanidharan
New User
Joined: 20 Jun 2005 Posts: 86 Location: Chennai, India
|
|
|
|
Minor correction Parikshit -
If file doesn't exist, your job would not execute due to JCL error. For mrar_160's purpose, execution must continue; hence the usage of INDATASET rather than INFILE.
Code: |
//*********************************************************************
//* FILE NOT EXISTING : RC = 12
//* EMPTY FILE : RC = 04
//* DATA FILE : RC = 00
//*********************************************************************
//STEP010 EXEC PGM=IDCAMS
//SYSUDUMP DD SYSOUT=C
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
PRINT IDS('AAA.BBB') -
CHARACTER COUNT(1)
/*
//*
|
In addition, I am not sure if PRINT can be used for non-SMS datasets (since mrar_160 has already brought up this issue); it doesn't seem to have parameters for specifying catalogs. |
|
Back to top |
|
|
mrar_160
New User
Joined: 14 Sep 2005 Posts: 48
|
|
|
|
Yes bharanidharan, you are in line with me..
The solution you gave to me earlier only can list the sms dataset..I tried to list my desire dataset (nonsms dataset) then i got RC4 with msg :
LISTCAT ENTRIES('AAA.BBB')
IDC3012I ENTRY AAA.BBB NOT FOUND
IDC3009I ** VSAM CATALOG RETURN CODE IS 8 - REASON CODE IS IGG0CLEG-42
IDC1566I ** AAA.BBB NOT LISTED
I also had tried your solution below, but it seen didnot fine the nonsms dataset..the msg is :
Code: |
PRINT IDS('AAA.BBB') -
CHARACTER COUNT(1)
IKJ56228I DATA SET AAA.BBB IN CATALOG OR CATALOG CAN
IKJ56228I NOT BE ACCESSED
IDC0005I NUMBER OF RECORDS PROCESSED WAS 0
IDC3003I FUNCTION TERMINATED. CONDITION CODE IS 12 |
Even the AAA.BBB dataset is exist. |
|
Back to top |
|
|
Bharanidharan
New User
Joined: 20 Jun 2005 Posts: 86 Location: Chennai, India
|
|
|
|
As I said before, PRINT won't possibly work.
But for LISTCAT, did you try the CATALOG option along with ENTRIES? |
|
Back to top |
|
|
mrar_160
New User
Joined: 14 Sep 2005 Posts: 48
|
|
|
|
I had tried using listcat with CATALOG option. but i got problem how to know my ctlgname.
Quote: |
catlgname is the name of the catalog having the entry |
can you give an example?? I dont understand.. |
|
Back to top |
|
|
sundaresanjs
New User
Joined: 29 May 2006 Posts: 18 Location: USA
|
|
|
|
hi mrar_160,
its simple logic you can use the step condition for it,
let us take your example, if datasetA exists then it must stop or else it must continue,
Code: |
//job........
//step1 exec pgm=IEBGENER
//sysut1 dd dsn=DATASETA.PS,DISP=SHR
//sysut2 dd dsn=DATAB.PS,DISP=(NEW,DELETE,DELETE),
DCB=(LREC=80,BLK=800,FB)
//*give the parameters accoring to the DATASETA
//sysout dd sysout=*
//sysin dd dummy
//sysprint dd sysout=*
//step2 exec pgm=........,COND=(0,EQ,step1)
//......
//.........
//....
/*
|
in the above program if the DATASETA exists then the return code will be 0 and the step2 will not execute due to the condition specified,
or you can give COND=ONLY
which specifies that it will execute the step only when the previous step ennded abnormally,
comment any errors,
regards, |
|
Back to top |
|
|
mrar_160
New User
Joined: 14 Sep 2005 Posts: 48
|
|
|
|
sundaresanjs, thank for your reply..
I cannot do like that.It is because, there is another job that will allocate dataset A. So, if i allocate dataset A, then the next job will not be able to allocate dataset A.
I need to check the dataset A, if there is dataset A exist, then my job will stop to execute next step.
Now, my problem is the dataset A is in nonsms, so i got problem to check dataset A. The solution that Bharanidharan gave, it only can cater for sms dataset, i tried for nonsms dataset, but it didnt find the nonsms dataset.
Hope anyone here can help.
Tq. |
|
Back to top |
|
|
Bharanidharan
New User
Joined: 20 Jun 2005 Posts: 86 Location: Chennai, India
|
|
|
|
All your catalog entries (VSAM and non-VSAM datasets) are stored in either master catalog or user catalog, may it be SMS or non-SMS managed datasets. You can obtain a list of user catalogs that can contain the datasets created in your LPAR using IDCAMS LISTCAT USERCATALOG. These catalogs are created during the initial setup and can be changed (with limitations) at any time.
Now, while creating SMS datasets, if catalog name is not mentioned, file would be created in the default system catalog (here I am not sure how to identify which is the default catalog; you may need to ask your storage group). Specific storage classes, and hence volumes, (or a group of them) would be linked with each catalog. You can override the default catalog with CATALOG option while creating.
But for non-SMS datasets, I believe you need to mention catalog name (and pwd if it is pwd controlled) while creating it. And, if your dataset is created usually in a particular volume serial (or unit), then it would always be created in one catalog only, since that volume group is related with that catalog.
What you need to do:
1. If you have some other datasets defined in the same volume (or storage class) in which you expect your file to be created, find the catalog in which they reside by using LISTCAT command (or using File-Aid;Fileaid will clearly show you the catalog).
2. Plug in the catalog name in the CATALOG option. |
|
Back to top |
|
|
Salil Pant
New User
Joined: 03 Jun 2009 Posts: 3 Location: India
|
|
|
|
Is this command applicable to check the presence of member of a PDS? I tried using it but it is not giving me desired results. |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Salil Pant wrote: |
Is this command applicable to check the presence of member of a PDS? I tried using it but it is not giving me desired results. |
Mmmmmmmmmmm, now where did I put my crystal ball to see exactly what the problem is ?
Maybe in the meantime you could ellaborate a little on that wonderful phrase "I tried using it but it is not giving me desired results" |
|
Back to top |
|
|
Salil Pant
New User
Joined: 03 Jun 2009 Posts: 3 Location: India
|
|
|
|
It just means that can we use LISTCAT command to check if member of a PDS is present or not?
I tried giving
LISTCAT ENTRIES('XXXX.YYYY(member)')
But this is checking only for the presence of PDS not specifically for the member |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
|
|
|
|
Checking for members you will probably need a REXX exec to use the SYSDSN function. |
|
Back to top |
|
|
|