Page 1 of 1

To know whether GDG with generation exists

PostPosted: Thu Sep 24, 2009 10:55 pm
by vinu78
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

Re: To know whether GDG with generation exists

PostPosted: Thu Sep 24, 2009 11:57 pm
by MrSpock
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.

Re: To know whether GDG with generation exists

PostPosted: Sat Sep 26, 2009 3:00 am
by vinu78
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

Re: To know whether GDG with generation exists

PostPosted: Sat Sep 26, 2009 4:58 pm
by expat
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.

Re: To know whether GDG with generation exists

PostPosted: Mon Sep 28, 2009 8:02 pm
by vinu78
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

Re: To know whether GDG with generation exists

PostPosted: Mon Sep 28, 2009 8:33 pm
by MrSpock
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

Re: To know whether GDG with generation exists

PostPosted: Wed Sep 30, 2009 8:41 pm
by vinu78
Thanks Spock.
It worked like a charm.

Rgds
Vinu

Re: To know whether GDG with generation exists

PostPosted: Wed Sep 30, 2009 10:07 pm
by MrSpock
I'm curious to know why the LISTDSI or LISTCAT solutions didn't provide the information that you needed?

Re: To know whether GDG with generation exists

PostPosted: Sat Oct 03, 2009 2:31 am
by vinu78
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

Re: To know whether GDG with generation exists

PostPosted: Sat Oct 03, 2009 3:12 am
by dick scherrer
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?