Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Checking for availability of file.

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Checking for availability of file.
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: 7913
Location: Bellevue, IA

PostPosted: Mon Mar 19, 2012 6:33 pm    Post subject:
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

Moderator Team Head


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

PostPosted: Mon Mar 19, 2012 6:35 pm    Post subject: Reply to: Checking for availability of file.
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Mar 19, 2012 6:36 pm    Post subject: Reply to: Checking for availability of file.
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    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7236

PostPosted: Mon Mar 19, 2012 6:58 pm    Post subject: Reply to: Checking for availability of file.
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    Post subject: Checking for availability of file
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: 7913
Location: Bellevue, IA

PostPosted: Wed Jul 13, 2016 3:21 am    Post subject:
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

Senior Member


Joined: 21 Sep 2010
Posts: 1610
Location: NY,USA

PostPosted: Wed Jul 13, 2016 3:44 pm    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10203
Location: italy

PostPosted: Wed Jul 13, 2016 3:48 pm    Post subject: Reply to: Checking for availability of file.
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us