Page 1 of 1

How to read a PDS Directory List of Members using COBOL?

Posted: Fri Jul 19, 2013 11:56 am
by Manoj
Hi,

Is it possible to obtains the member list in a COBOL program?

If not, what is the best way of doing this?

Thanks.

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Fri Jul 19, 2013 4:24 pm
by Robert Sample
Yes, it is possible -- I've written a COBOL program that produces a report of the ISPF statistics for all members of a PDS. The code is not particularly tricky, but it is definitely well beyond a beginner's level (for example, the PDS directory is 256-byte records no matter what the LRECL of the PDS is).

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Sat Jul 20, 2013 11:35 am
by Manoj
That sounds interesting, may I ask for the code?

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Sat Jul 20, 2013 7:58 pm
by Robert Sample
Attached is READPDS2.COB, the COBOL code. It reads a file of PDS data set names, dynamically allocates each, then prints the ISPF statistics (if any) for the PDS.

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Mon Jul 22, 2013 11:42 am
by Manoj
Thank You so much Robert. I've downloaded the readpds2.txt and will be uploading it to Mainframes and work with it.

I'll let you know, how I progress.

Thanks,

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Mon Aug 05, 2013 3:28 pm
by Anuj Dhawan
I also got intrested in it and downloaded the program. This worked GREAT in a single go, much appreciate your contribution Robert. This is a keeper..:)

Code: Select all

12013/08/05                                READPDS  - READ AND DISPLAY PDS ISPF STATISTICS                                 PAGE     1
 05:44:04.93                                PROGRAM COPYRIGHT BY ROBERT SAMPLE 2012
                                            DSNAME: T1234AD.ABC.EXEC1
0MEMBER NAME ISPF VV.MM CREATE DATE CHANGE DATE CHANGE TIME CURRENT SIZE  INITIAL SIZE  MODIFIED LNS  USER ID
 ADDDISP          01.04 2011/12/12  2011/12/12  08:14:44              24            23             0  T1234AD
 BANNER           01.00 2013/05/15  2013/05/15  08:39:13              17            17             0  T1234AD
 BATCHMAC         01.00 2012/04/04  2012/04/04  10:09:19              32            32             0  T1234AD
 TOTAL MEMBERS              3                                         73            72             0
 DIRECTORY BLOCKS READ      1
-DATA SETS PROCESSED        1

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Mon Aug 05, 2013 4:52 pm
by Robert Sample
Thanks Anuj. These days COBOL is much more versatile than many people realize. I haven't done much with the object-oriented COBOL on z/OS (yet), but I have managed to read a PDS directory as well as process DCOLLECT and SMF data through COBOL (although the SMF program did require one assembler routine for the 64-bit clock values).

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Mon Aug 05, 2013 6:33 pm
by Anuj Dhawan
Yes I agree, as you said - COBOL is much more versatile than many people realize and with OOCOBOL and OpenCobol the possiblites aare multifold now.

I've that "SMF-program" of yours and will be working with that too soon. It's been kept with me for longer than anticipated - :oops: (the personal front had been keeping me busy like crazy lately and still is).

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Thu Aug 08, 2013 7:13 pm
by Manoj
Thank You Robert. It worked well...:)

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Thu Aug 08, 2013 7:35 pm
by Robert Sample
Great -- glad to hear that it worked for you.

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Mon Jan 20, 2014 11:07 pm
by mrroot
Hi

Very nice program. You call BPXWDYN for dynamic file allocation. Where is the code for that?

Thanks

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Mon Jan 20, 2014 11:27 pm
by Anuj Dhawan
Hello mrroot and welcome to the Forums,

Yup, that's an excellent piece of code from Robert.
You call BPXWDYN for dynamic file allocation. Where is the code for that?
You mean the code for BPXWDYN?

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Tue Jan 21, 2014 1:32 am
by zprogrammer
Very very useful and rare data indeed...

Robert,
Can this code be displayed at Tips?

Re: How to read a PDS Directory List of Members using COBOL?

Posted: Tue Jan 21, 2014 4:53 am
by Robert Sample
BPXWDYN is an IBM-provided routine to perform dynamic allocation similar to the TSO ALLOC command. It is in one of the system libraries but I don't recall which right now -- when I get a chance I'll see where it shows up.

Anuj -- think the code belongs in Tips?