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

How to check whether a particular member is present in a PDS


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

New User


Joined: 22 Nov 2008
Posts: 30
Location: hyderabad

PostPosted: Fri May 18, 2012 4:39 pm
Reply with quote

How to check whether a particular member is present in a PDS using any utility or any way can we do it in a JCL

I know it can be done in REXX but searching for a way in a JCL as i have a requirement as shown below

COPY01 EXEC PGM=IEBGENER
SYSPRINT DD SYSOUT=*
SYSOUT DD SYSOUT=*
SYSIN DD DUMMY
SYSUT1 DD DSN=XXX.YYY(M1),DISP=SHR
DD DSN=XXX.YYY(M2),DISP=SHR
SYSUT2 DD DSN=XXX.ZZZZ(YYYY),DISP=SHR

the problem is M2 isn't being Created in the above Step, hence this step(copy01) is failing and the sysut2 isn't created

Looking for help on this

Thanks,
Chanti.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri May 18, 2012 4:53 pm
Reply with quote

M2 does not exist in pds XXX.YYY?

then why have you included it in SYSUT1?
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri May 18, 2012 5:11 pm
Reply with quote

Already discussed
Please check here
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri May 18, 2012 5:16 pm
Reply with quote

normally, one insures that dataset names provided on (input) dd statements
are of datasets that exist.

the utility used to determine if a dataset exists,
should have been the utility to generate the jcl for your iebgener step.

why don't you explain why you have a dd statement for a non-existing file?

and the thread referenced by Pandora's Box
is just that.

using IEHLIST and parsing with sort could provide the answers,

but than again,
why a dsn that does not exist?
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri May 18, 2012 5:21 pm
Reply with quote

Or there could be some Psychic guy who is deleting your member purposely??? icon_lol.gif icon_lol.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri May 18, 2012 6:57 pm
Reply with quote

Hello,

If you explain what you are tryijng to accomplish (rather than how you have already tried to implement), someone may have a suggestion.
Back to top
View user's profile Send private message
chanti

New User


Joined: 22 Nov 2008
Posts: 30
Location: hyderabad

PostPosted: Fri May 18, 2012 7:49 pm
Reply with quote

Actually M2 is created in the above step, if the program doesn't do well M2 isn't being created

As i cant control the program to create M2, i need to handle below in the JCL

I want the IEBGENER step to be run regardless whether M2 is created or not

Thanks,
Chanti.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri May 18, 2012 7:59 pm
Reply with quote

Quote:
Actually M2 is created in the above step, if the program doesn't do well M2 isn't being created


What does program doesn't do well mean?

a.Program doesnt execute and fails due to some criteria
b.Program doesnt execute as expected by you?

If you are very sure the quoted statement is correct check with the people in your team who knows better idea of the program which creates M2 and try to understand when it creates a member and when it does not

and also try to understand the need of having the IEBGENER step after that

Try to pass different return codes when M2 is created and when it is not and with that conditional return code execute your IEBGENER step
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Fri May 18, 2012 7:59 pm
Reply with quote

Run your copy to copy M! only. Next step do something to check if M2 exists (rexx and set return code?). 3rd step do,or not do depending on condition codes, second copy. Or check first and then either do your IEBGENER as posted or a different gener step to copy only M1.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri May 18, 2012 8:00 pm
Reply with quote

Hello,

Then you need a different approach.

One alternative might be to have an "empty" M2 member and this is overwritten with data when appropriate. The M2 member would be emptied just before it might be created (depending on how the run processes).

This way the member would always exist and there would be no jcl error. . .
Back to top
View user's profile Send private message
chanti

New User


Joined: 22 Nov 2008
Posts: 30
Location: hyderabad

PostPosted: Fri May 18, 2012 8:08 pm
Reply with quote

Creation of M2 isn't under our control...

Thanks all for your valuable suggestions..

For me, Dick Scherrer idea of creating an empty member would be good..

i'm still looking for better solution, if found will keep you posted

Thanks,
Chanti
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri May 18, 2012 8:21 pm
Reply with quote

how about telling us what you need to do, (description of requirements/resources/etc...)
not how you have decided to do it.
Back to top
View user's profile Send private message
Pandora-Box

Global Moderator


Joined: 07 Sep 2006
Posts: 1592
Location: Andromeda Galaxy

PostPosted: Fri May 18, 2012 8:22 pm
Reply with quote

Dick you stole words from my fingers :-D

I could see your typing speed indeed :-P
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Fri May 18, 2012 8:24 pm
Reply with quote

Quote:
If you explain what you are trying to accomplish (rather than how you have already tried to implement), someone may have a suggestion.
Or from this earlier reply. . . To which TS did post a reply.

d
Back to top
View user's profile Send private message
chanti

New User


Joined: 22 Nov 2008
Posts: 30
Location: hyderabad

PostPosted: Fri May 18, 2012 8:32 pm
Reply with quote

as i already quoted

"I want the IEBGENER step to be run regardless whether M2 is created or not"

Thanks,
Chanti
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Fri May 18, 2012 8:52 pm
Reply with quote

the only way to determine if M2 exists or not is to access the PDS Directory.

to do so,
run some utility program (IEHLIST) to print the directory,
followed by something (SORT) to parse the listing and generate an appropriate rc

or

run a rexx step to generate the RC

you can not mod to the member to create it if it is not there with the DISP parms
as you can with a QSAM file.

the decision of which method to used is based on
whether or not
you want an 'empty' M2?

once you have answered that question (empty M2)
you can follow Nic's advice here
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Sat May 19, 2012 3:27 am
Reply with quote

chanti wrote:
Actually M2 is created in the above step, if the program doesn't do well M2 isn't being created.

"if the program doesn't do well" then maybe it has a non-zero return code.
Did you check that ?
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 Using Multiple IFTHEN and WHEN condit... SYNCSORT 12
No new posts Check if CICS is online in JCL CICS 10
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts How to check whether who renamed the ... JCL & VSAM 3
Search our Forums:

Back to Top