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

Checking for availability of file.


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

Active User


Joined: 18 Jan 2010
Posts: 143
Location: Pune

PostPosted: Mon Mar 19, 2012 6:25 pm
Reply with quote

Hi,
The IDCAMS utility will help me to know if any dataset exists or not.

In my JCL a PROC is called and infile is provided as override.

//ABC PROC=ABC,INFILE=AAA.BBB
Using this symbolic parameter it is possible to check if it file exists or not in PROC:
//JS10 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT ENTRIES(&INFILE)
/*
While using above syntax i am getting following error:
IDCAMS SYSTEM SERVICES TIME: 07:48:

LISTCAT ENTRIES(&INFILE)
IDC3203I ITEM '&INFILE' DOES NOT ADHERE TO RESTRICTIONS
IDC3202I ABOVE TEXT BYPASSED UNTIL NEXT COMMAND. CONDITION CODE IS 12

IDC0002I IDCAMS PROCESSING COMPLETE. MAXIMUM CONDITION CODE WAS 12

Regards,
Krunal Bafna
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: Mon Mar 19, 2012 6:33 pm
Reply with quote

Unless you are using z/OS 1.13, IDCAMS will not allow ANY use of symbolic parameters (anything starting &) so what you are attempting will not work, period, until your site upgrades to z/OS 1.13.

Once submitted and through the JES converter / interpreter, it is not possible to change JCL -- so I suspect you will need two jobs to do whatever you are attempting to accomplish.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Mon Mar 19, 2012 6:35 pm
Reply with quote

Trying to replicate your test, and I can't get far enough along to even invoke the IDCAMS step without getting a JCL error. Granted, I'm not on the latest version of z/OS.

Could you post your JESYSMSG output that shows how JES is handling the variable substitution of &INFILE from the job, to the PROC, and ultimately to that step?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Mar 19, 2012 6:36 pm
Reply with quote

OK, this is related to this topic. Perhaps I should have said "next time".

If you put your file on a DD name and submit the Job, the system will go out of its way to tell you that the file does not exist, if it doesn't.

What you have not explained is why you otherwise want to know whether the file exists. If you explain the reason you are trying to do it this way, you may get some answers.

If you are desperate to use IDCAMS in this way, and unwilling to explain further, then you need to generate the IDCAMS control card from a program which can take the substituted symbol. DFSORT comes to mind, for one.
Back to top
View user's profile Send private message
krunalbafna
Warnings : 1

Active User


Joined: 18 Jan 2010
Posts: 143
Location: Pune

PostPosted: Mon Mar 19, 2012 6:48 pm
Reply with quote

I am trying to do this beacuse:
I am submitting the JOB online using CICS. The first step I need to check if user has entered valid dataset or not. If dataset does not exists, it shall be an invalid testing. So i need to check if file entered exists or not.

SO i am using LISTCAT as first step in my proc to check validity of file.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Mar 19, 2012 6:53 pm
Reply with quote

so, you are going to a lot of trouble to determine if a dataset exists or not.

Quote:
it shall be an invalid testing


WTF does that mean?

forget this nonsense about validating ds existance.

let the job bomb on a JCL error (allocate attempts to allocate a non-existant file)
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Mon Mar 19, 2012 6:58 pm
Reply with quote

Surely you're not letting a user type a dataset name? What if they try with something they shouldn't be accessing?

What are they going to be doing with the dataset?

Can't you give them a list of datasets (which exist) which are relevant to their task, and get them to pick something from the list?
Back to top
View user's profile Send private message
PaulaZ Paula Zankel

New User


Joined: 23 Mar 2016
Posts: 1
Location: USA

PostPosted: Wed Jul 13, 2016 3:01 am
Reply with quote

I am Z/OS 2.1 and I don't see any references to IDCAMS allowing symbolic substitution in its SYSIN contents i.e.LISTCAT ENTRIES(&INFILE) as posted by Mr. Sample at Posted: Mon Mar 19, 2012 8:03 am

I need to know if a dataset exists, and if it doesn't, then allocate it. I want to pass a portion of the dataset name to IDCAMS to be substituted.
ALLOCATE DATASET('someprefix.&ACCUM'),OLD

RC=12 when the dataset does not exist, and 0 when it does.

Can someone suggest a way to pass the value of &ACCUM as a parameter or build it using JCL
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 Jul 13, 2016 3:21 am
Reply with quote

This JCL works just fine on my z/OS 2.1 system:
Code:
// EXPORT SYMLIST=(INFILE)                 
// SET INFILE=RLS.JCL.CNTL                 
//STEP1    EXEC PGM=IDCAMS,REGION=0M       
//SYSPRINT DD   SYSOUT=*                   
//SYSOUT   DD   SYSOUT=*                   
//SYSIN    DD   *,SYMBOLS=EXECSYS         
  LISTCAT ENT(&INFILE)                     
/*                                         
//                                         
and output is
Code:
********************************* TOP OF DATA *********************************************************************
IDCAMS  SYSTEM SERVICES                                           TIME: 16:45:55        07/12/16     PAGE      1   
                                                                                                                   
  LISTCAT ENT(RLS.JCL.CNTL)                                                                                       
NONVSAM ------- RLS.JCL.CNTL                                                                                       
     IN-CAT --- CATALOG.VMVS001.MASTER                                                                             
IDCAMS  SYSTEM SERVICES                                           TIME: 16:45:55        07/12/16     PAGE      2   
         THE NUMBER OF ENTRIES PROCESSED WAS:                                                                     
                   AIX -------------------0                                                                       
There is a chapter in the JCL Reference manual on Using symbols in JES in-stream data that is a starting place. If you were looking at the IDCAMS documentation, you were looking in the wrong place. This is a change to z/OS JCL and JES, not IDCAMS.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3053
Location: NYC,USA

PostPosted: Wed Jul 13, 2016 3:44 pm
Reply with quote

Just to know TS replied to 4 years old post. Please start a new post next time with your problems and refer this existing post ( if required) when you type a new post.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Wed Jul 13, 2016 3:48 pm
Reply with quote

Quote:
and I don't see any references to IDCAMS allowing symbolic substitution in its SYSIN contents


not an IDCAMS facility/feature,
symbolic substitution in inline data is a a system facility/feature
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top