Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Read all members of a PDS with COBOL

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Thu Jul 26, 2007 12:30 pm    Post subject: Read all members of a PDS with COBOL
Reply with quote

My previous post is lost (yesterday), so I write it again.

Is there a way to read a PDS file with a COBOL program ?
Back to top
View user's profile Send private message

William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Jul 26, 2007 12:50 pm    Post subject:
Reply with quote

Sure, point an FD to a DD that is a PDS member and read it....
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 130
Location: Guntur

PostPosted: Thu Jul 26, 2007 3:03 pm    Post subject:
Reply with quote

Hi William,

Can you explain this a bit more elaborately

Quote:

point an FD to a DD that is a PDS member and read it....
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Jul 26, 2007 3:09 pm    Post subject:
Reply with quote

balakrishna reddy wrote:
Can you explain this a bit more elaborately
Do you understand COBOL?
SELECT FDname assign to DDname
//DDname DD dsn=PDSname(membername)
Back to top
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Thu Jul 26, 2007 3:15 pm    Post subject:
Reply with quote

Hi,

You can read a PDS in cobol program, as you do to PS file.
As PDS and PS are one and the same internally, while externally (We) see that differently, When you create a PDS some space is allocated for storing the member information.

EX:
you have 3 members
and you access 2nd member, when accessing it will open the records of 2nd member. But internally all the members come in order they are created.
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Thu Jul 26, 2007 6:14 pm    Post subject:
Reply with quote

Hello,

I believe this is mis-leading
Quote:
But internally all the members come in order they are created.
and will cause more confusion than assistance.

When you put the DD statement in your jcl (as Bill recommended)
Quote:
//DDname DD dsn=PDSname(membername)

there is no consideration of how the system stores the members internally. The named member will be read sequentially, just the same as a PS dataset. The code and the jcl use the same convention that is used for PS files.
Back to top
View user's profile Send private message
kgumraj

Active User


Joined: 01 May 2006
Posts: 151
Location: Hyderabad

PostPosted: Thu Jul 26, 2007 6:21 pm    Post subject:
Reply with quote

Hi Dick,

I was not Misleading, but little explanatory.
My first line told the answer and the other lines was explanation what was the reason behind that.

If that causes confusion do excuse.
Back to top
View user's profile Send private message
Searchman

New User


Joined: 28 Dec 2006
Posts: 80
Location: France

PostPosted: Thu Jul 26, 2007 11:43 pm    Post subject: Re: Read a PDS file with COBOL
Reply with quote

Sorry, but I don't understand very well

William wrote :

Quote:
SELECT FDname assign to DDname
//DDname DD dsn=PDSname(membername)


and Kgumraj :
Quote:
you have 3 members
and you access 2nd member, when accessing it will open the records of 2nd member. But internally all the members come in order they are created.


What I want to do is to read all the members of the PDS, one by one, so is it possible to write this (without membername)
//DDname DD dsn=PDSname ?
[/b]
Back to top
View user's profile Send private message
dick scherrer

Site Director


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

PostPosted: Fri Jul 27, 2007 2:12 am    Post subject:
Reply with quote

Hello,

No, you cannot name only the dataset and not the member in your jcl and read all of the members. The access method does not support that.

If you run a multi-step process, you could list all of the member names, from the list generate concatenated dd statements for each member, then use the generated dd statements in your process.

Depending on how many members are in the pds, you may need to create multiple sets.
Back to top
View user's profile Send private message
superk

Moderator Team Head


Joined: 26 Apr 2004
Posts: 4650
Location: Raleigh, NC, USA

PostPosted: Fri Jul 27, 2007 2:15 am    Post subject: Re: Read all members of a PDS with COBOL
Reply with quote

You'd want to use the ISPF LMMLIST Service, among possible others (LMINIT, LMOPEN, LMGET, LMPUT, LMCLOSE) to access the PDS directory structure programatically.
Back to top
View user's profile Send private message
Douglas Wilder

Active User


Joined: 28 Nov 2006
Posts: 305
Location: Deerfield IL

PostPosted: Fri Jul 27, 2007 2:25 am    Post subject:
Reply with quote

I believe that what you are asking for could be done by dynamically allocating one member of the PDS, opening, reading, and closing that member, and freeing and dynamically allocating the next member, etc.

There are other postings on this forum on how to do the dynamic allocation. One way is for the COBOL program to call a REXX to do the free and allocate.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Cobol to fetch the content by using s... arunc55 COBOL Programming 4 Fri Nov 17, 2017 1:25 pm
No new posts VBS and VB, COBOL syntax is the same ... natt.sut COBOL Programming 3 Sun Nov 12, 2017 6:36 am
No new posts COBOL - EXIT statement weird behavior anthony.pangestu COBOL Programming 0 Fri Oct 27, 2017 9:57 am
No new posts IEW2456E error when link-editing a C ... Senthilraj JCL & VSAM 0 Fri Oct 13, 2017 3:12 pm
No new posts Assembler Macro Copybook converted to... Ziquilix PL/I & Assembler 4 Tue Sep 26, 2017 3:07 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us