View previous topic :: View next topic
|
Author |
Message |
Searchman
New User
Joined: 28 Dec 2006 Posts: 80 Location: France
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
Sure, point an FD to a DD that is a PDS member and read it.... |
|
Back to top |
|
|
balakrishna reddy
Active User
Joined: 13 Jul 2007 Posts: 128 Location: Guntur
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
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 |
|
|
kgumraj
Active User
Joined: 01 May 2006 Posts: 151 Location: Hyderabad
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
kgumraj
Active User
Joined: 01 May 2006 Posts: 151 Location: Hyderabad
|
|
|
|
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 |
|
|
Searchman
New User
Joined: 28 Dec 2006 Posts: 80 Location: France
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
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 |
|
|
Douglas Wilder
Active User
Joined: 28 Nov 2006 Posts: 305 Location: Deerfield IL
|
|
|
|
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 |
|
|
|