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
 

 

How to check whether a dataset exist or not

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
dilson joseph

New User


Joined: 18 Apr 2008
Posts: 6
Location: pune

PostPosted: Fri Apr 18, 2008 9:42 am    Post subject: How to check whether a dataset exist or not
Reply with quote

Hi all,
I am facing a problem in my jcl, where i trying to check whether a dataset exist or not using IDCAMS. but i was getting a jcl error. here is my jcl
//step0110 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT ENTRIES('XUTC515.&DTST.&LPART')
/*
later i came to know that i have to give the exact name of the dataset in listcat entries.
is there any other way to create a jcl with my current requirement. please do help.
Back to top
View user's profile Send private message

sri_mf

Active User


Joined: 31 Aug 2006
Posts: 216
Location: India

PostPosted: Fri Apr 18, 2008 10:54 am    Post subject: Re: How to check whether a dataset exist or not
Reply with quote

dilson joseph wrote:
Hi all,
I am facing a problem in my jcl, where i trying to check whether a dataset exist or not using IDCAMS. but i was getting a jcl error. here is my jcl
//step0110 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT ENTRIES('XUTC515.&DTST.&LPART')
/*
later i came to know that i have to give the exact name of the dataset in listcat entries.
is there any other way to create a jcl with my current requirement. please do help.


LISTCAT ENTRIES works fine for the original dataset.I have tried executing ur code.
It returns the MAxcc=4 if the dataset does not exist.
Code:

IDCAMS  SYSTEM SERVICES                                           
   LISTCAT ENTRIES('XXXXXX.LIST.FF')
IDC3012I ENTRY XXXXX.LIST.FF NOT FOUND
IDC3009I ** VSAM CATALOG RETURN CODE IS 8 - REASON CODE IS IGG0CLEG-42
IDC1566I ** ZXDEVIR.LIST.FF NOT LISTED


Provide more info abt ur requirement ...
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 276
Location: Bang,iflex

PostPosted: Fri Apr 18, 2008 10:59 am    Post subject:
Reply with quote

Hi,

Check this Link

http://ibmmainframes.com/about7634.html

LISTCAST will just give you info reg the all gen's and limit
and other parameters like AIX, INDEX, PATH ENTRIES PROCESSED,
but getting the file creat datea and procesing can ...

Still your requirement is not clear


you should give cataloged dataset
Back to top
View user's profile Send private message
dilson joseph

New User


Joined: 18 Apr 2008
Posts: 6
Location: pune

PostPosted: Fri Apr 18, 2008 11:36 am    Post subject:
Reply with quote

hi thank u very much for ur fast reply.
i have tried before the same jcl with the name of the original dataset it worked fine. that is if we are giving
LISTCAT ENTRIES('XUTC515.cca.dsos.waybill.d1804') it will work fine.
but when we are giving a variable name that has the name of the dataset then this does not work.
as if LISTCAT ENTRIES('XUTC515.&DTST.&LPART') that is it will return rc=4 if the dataset is not there. in my jcl "&DTST" will contain the body part of the original dataset and "&LPART" will contain the extension part of the original dataset and then i am concatenating them. thus we can consider XUTC515.&DTST.&LPART as a variable name for the original dataset. so what i wanted is when we give the variable name it should check whether the dataset incoprated is existing or not.
Back to top
View user's profile Send private message
dilson joseph

New User


Joined: 18 Apr 2008
Posts: 6
Location: pune

PostPosted: Fri Apr 18, 2008 11:38 am    Post subject:
Reply with quote

sorry for a mistake above in this part "as if LISTCAT ENTRIES('XUTC515.&DTST.&LPART') that is it will return rc=4 if the dataset is not there"

it wont return rc=4 when the dataset is not there rather it will show jcl error.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8593
Location: Back in jolly old England

PostPosted: Fri Apr 18, 2008 11:39 am    Post subject:
Reply with quote

That's because symbolic substitution is a JCL facility, not applicable for SYSIN cards.

You CAN NOT use &whatever in SYSIN cards
Back to top
View user's profile Send private message
Bill Dennis

Active Member


Joined: 17 Aug 2007
Posts: 562
Location: Iowa, USA

PostPosted: Fri Apr 18, 2008 6:59 pm    Post subject:
Reply with quote

You could write a simple pgm to read the DSN from a PARM (where you can use symbolics) and write the dsn to an output file. Concatenate that file into the IDCAMS SYSIN as:
Code:
//SYSIN  DD *
 LISTCAT ENTRIES(
//     DD DSN=YOUR.DSN.CARD,DISP=SHR
//     DD *
 )   /* final paren */
/*
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Fri Apr 18, 2008 9:56 pm    Post subject:
Reply with quote

Try this, JCL can do the substitution in a parm.
Code:
000224 //  SET HLQ=hlq                                     
//  SET NODE2=testnode                               
//STEP1 EXEC PGM=IKJEFT01,                           
//   PARM='%RUNPARM LISTCAT ENT(''&HLQ..&NODE2'')'   
//SYSEXEC   DD DSN=hlq.REXX.EXEC,DISP=SHR       
//SYSTSPRT DD  SYSOUT=*                             
//SYSTSIN  DD  DUMMY                                 


Where hlq.REXX.EXEC(runparm) contains
Code:
/* REXX RUNPARM */
Parse Upper Arg prm
SAY prm           
prm               
Exit RC           
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Fri Apr 18, 2008 10:15 pm    Post subject:
Reply with quote

Why do I try the hard way first? No Rexx needed.
Try this:
Code:
//  SET HLQ=hlq                             
//  SET NODE2=testnode                       
//STEP1 EXEC PGM=IKJEFT01,                   
//   PARM='LISTCAT ENT(''&HLQ..&NODE2'')'   
//SYSTSPRT DD  SYSOUT=*                     
//SYSTSIN  DD  DUMMY                         
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 686
Location: Earth

PostPosted: Mon Apr 21, 2008 7:43 pm    Post subject:
Reply with quote

Good one Douglas! icon_smile.gif
Back to top
View user's profile Send private message
veena_nagesh2002
Warnings : 1

Active User


Joined: 07 May 2005
Posts: 110
Location: hyderabad

PostPosted: Wed Aug 20, 2008 11:52 am    Post subject: when the file is present in the system need to take a copy
Reply with quote

//PUXXXXX JOB (@),LISTCAT,MSGCLASS=R,CLASS=0,NOTIFY=PU7052A
//step0110 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
LISTCAT ENTRIES('PUXXX.ADC1.COPYLIB')
/*

is it possible only when the file is present in the system need to take a copy or else need to through a RC specified. This should happen in a single step. note : suggest me with any JCL utility
Back to top
View user's profile Send private message
Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Wed Aug 20, 2008 12:26 pm    Post subject: Reply to: How to check whether a dataset exist or not
Reply with quote

Veena,

Quote:
is it possible only when the file is present in the system need to take a copy or else need to through a RC specified. This should happen in a single step.


Post is confusing and not clear.

Quote:
note : suggest me with any JCL utility


Only when you tell us about your requirement.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2276
Location: @my desk

PostPosted: Wed Aug 20, 2008 12:44 pm    Post subject:
Reply with quote

Dint you get the solution in the other topic? Why posting the same question in multiple topics?

Thanks,
Arun
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 Fileaid 2 commands instream work. In ... descann Compuware & Other Tools 2 Tue May 16, 2017 3:31 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts To find out size allocated to a seque... ashek15 JCL & VSAM 15 Thu Apr 27, 2017 9:42 am
No new posts LISTCAT on a dataset with symbolic pa... shreya19 JCL & VSAM 5 Fri Apr 07, 2017 5:43 pm
No new posts Unable to catalog a gdg dataset resid... Shovan JCL & VSAM 7 Fri Mar 24, 2017 2:24 pm


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