IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Read all members of a PDS with COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
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
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: 3156
Location: Tucson AZ

PostPosted: Thu Jul 26, 2007 12:50 pm
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: 128
Location: Guntur

PostPosted: Thu Jul 26, 2007 3:03 pm
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: 3156
Location: Tucson AZ

PostPosted: Thu Jul 26, 2007 3:09 pm
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
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

Moderator Emeritus


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

PostPosted: Thu Jul 26, 2007 6:14 pm
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
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
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

Moderator Emeritus


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

PostPosted: Fri Jul 27, 2007 2:12 am
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

Global Moderator


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

PostPosted: Fri Jul 27, 2007 2:15 am
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Error to read log with rexx CLIST & REXX 11
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top