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

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
Manoj
Registered Member
Posts: 33
Joined: Wed Jul 17, 2013 9:10 am

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

Post 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.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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).
Manoj
Registered Member
Posts: 33
Joined: Wed Jul 17, 2013 9:10 am

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

Post by Manoj »

That sounds interesting, may I ask for the code?
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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.
You do not have the required permissions to view the files attached to this post.
Manoj
Registered Member
Posts: 33
Joined: Wed Jul 17, 2013 9:10 am

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

Post 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,
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

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

Post 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
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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).
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

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

Post 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).
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
Manoj
Registered Member
Posts: 33
Joined: Wed Jul 17, 2013 9:10 am

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

Post by Manoj »

Thank You Robert. It worked well...:)
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post by Robert Sample »

Great -- glad to hear that it worked for you.
mrroot
New Member
Posts: 1
Joined: Sat Jan 18, 2014 3:19 am

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

Post by mrroot »

Hi

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

Thanks
User avatar
Anuj Dhawan
Founder
Posts: 2802
Joined: Sun Apr 21, 2013 7:40 pm
Location: Mumbai, India
Contact:
India

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

Post 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?
Thanks,
Anuj

Disclaimer: My comments on this website are my own and do not represent the opinions or suggestions of any other person or business entity, in any way.
zprogrammer
Global Moderator
Global Moderator
Posts: 588
Joined: Wed Nov 20, 2013 11:53 am
Location: Mars

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

Post by zprogrammer »

Very very useful and rare data indeed...

Robert,
Can this code be displayed at Tips?
zprogrammer
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1895
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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?
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”