To know whether GDG with generation exists



IBM's Command List programming language & Restructured Extended Executor

To know whether GDG with generation exists

Postby vinu78 » Thu Sep 24, 2009 10:55 pm

Hi,

By means of REXX, could you please let me know how to check whether a GDG with (0) generation exists or not. If yES, I need to know the properties of it (LRECL).

Appreciate your help.

Thanks
Vinu
vinu78
 
Posts: 29
Joined: Sat Sep 27, 2008 4:47 am
Has thanked: 0 time
Been thanked: 0 time

Re: To know whether GDG with generation exists

 

Re: To know whether GDG with generation exists

Postby MrSpock » Thu Sep 24, 2009 11:57 pm

I'm not really sure what you mean here, so I'll try to offer as many thoughts as I can.

First of all, this is NOT going to be a REXX "thing" as much as it will be a TSO/ISPF or storage management "thing".

If you want to know if a dataset is cataloged, the TSO LISTDS command will tell you, and will return back details such as the LRECL.

REXX has the SYSDSN function which will tell you if the dataset exists.

REXX has the LISTDSI function which will tell you if a given dataset exists, and if so sets a group of variables that you can review.

SMS (System Managed Storage) has the LISTCAT command, which you can call to obtain all sorts of details.

Moving on the the world of ISPF, you have the ISPF DSINFO service, which returns the same details that you see in an ISPF 3.2 or 3.4 command.

Using ISPF Library Management (LM) services, you have LMDLIST to list dataset names.
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: To know whether GDG with generation exists

Postby vinu78 » Sat Sep 26, 2009 3:00 am

Hi Spock,

Thanks for the information.
I had used SYSDSN command to check whether the GDG with version exists and LISTDSI to get its properties if it exists.

However SYSDSN will not support GDG with relative versions (0, +1, -1). If I am giving the input as GDG dataset name with relative version ABC,TEST.FILE(0), will there be any function like SYSDSN in REXX that tells me that the GDG version exists or not.

Thanks
Vinu
vinu78
 
Posts: 29
Joined: Sat Sep 27, 2008 4:47 am
Has thanked: 0 time
Been thanked: 0 time

Re: To know whether GDG with generation exists

Postby expat » Sat Sep 26, 2009 4:58 pm

Please be aware of the difference between GENERATION and VERSION. Both are valid in terms of a GDS but havw completely different meanings. It is important to use the correct terminology when posting your questions as you may not get the answer you require if using the wrong terms.
expat
 
Posts: 382
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 1 time

Re: To know whether GDG with generation exists

Postby vinu78 » Mon Sep 28, 2009 8:02 pm

Thanks for the information. I will take care Expat.

Any solution to my above mentioned issue will be highly appreciated.
[Checking if the GDG with relative version Eg: ABC.TEST.FILE(0) exists or not.]

Thanks
Vinu
vinu78
 
Posts: 29
Joined: Sat Sep 27, 2008 4:47 am
Has thanked: 0 time
Been thanked: 0 time

Re: To know whether GDG with generation exists

Postby MrSpock » Mon Sep 28, 2009 8:33 pm

Try this:

/* REXX */                                               
gdg = 'ABC.TEST.FILE(0)'                               
rc = BPXWDYN("ALLOC DSN('"gdg"') SHR REUSE",       
"RTDSN(thedsn)")                           
Say rc thedsn                                         
Call BPXWDYN("FREE DSN('"gdg"')"                               
Exit 0             


BPXWDYN: Text Interface to Dynamic Allocation and Dynamic Output
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: To know whether GDG with generation exists

Postby vinu78 » Wed Sep 30, 2009 8:41 pm

Thanks Spock.
It worked like a charm.

Rgds
Vinu
vinu78
 
Posts: 29
Joined: Sat Sep 27, 2008 4:47 am
Has thanked: 0 time
Been thanked: 0 time

Re: To know whether GDG with generation exists

Postby MrSpock » Wed Sep 30, 2009 10:07 pm

I'm curious to know why the LISTDSI or LISTCAT solutions didn't provide the information that you needed?
User avatar
MrSpock
Global moderator
 
Posts: 810
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 2 times

Re: To know whether GDG with generation exists

Postby vinu78 » Sat Oct 03, 2009 2:31 am

Hi Spock,

Actually 2 months back we had moved around 1000 GDG to production region. The requirement is that by means of REXX utility, if we are entering the GDG name with relative version, it should give us whether the version exists or not and should show the properties. With this properties, we will create another dataset that will take backup using the properties.

Thanks
Chidam
vinu78
 
Posts: 29
Joined: Sat Sep 27, 2008 4:47 am
Has thanked: 0 time
Been thanked: 0 time

Re: To know whether GDG with generation exists

Postby dick scherrer » Sat Oct 03, 2009 3:12 am

Hello,

if we are entering the GDG name with relative version
You really must learn to use the proper terminology. . . There is no relative version.

If you try to check if relative generation -1 exists, what good is the answer?

I must admit that i'm somewhat confused . . . :?

If you "have" a file and simply copy it, the attributes of that file will be used for the copy. . .

Possibly, there is something i misunderstand?
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to CLIST & REXX