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

How to check whether a dataset exist or not


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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: 218
Location: India

PostPosted: Fri Apr 18, 2008 10:54 am
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: 275
Location: Bang,iflex

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

Hi,

Check this Link

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
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
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: 8797
Location: Welsh Wales

PostPosted: Fri Apr 18, 2008 11:39 am
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
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
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
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: 691
Location: Earth

PostPosted: Mon Apr 21, 2008 7:43 pm
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
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: 1287
Location: Chennai, India

PostPosted: Wed Aug 20, 2008 12:26 pm
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: 2481
Location: @my desk

PostPosted: Wed Aug 20, 2008 12:44 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Map Vols and Problem Dataset All Other Mainframe Topics 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts Allocated cylinders of a dataset DB2 12
Search our Forums:

Back to Top