I would like to get DCB info for a PDS.
If I have a PDS called "TEST.PDS" and I open it with zfile, and use the get blksize/dsorg/lrecl/recfm I get the info for a "PDSdir" back not a "PO".
I want the info pertaining to the PO.
DCB for PDS
ZFile is simply a wrapper for the C library I/O routines. For complete information on using the C library, refer to the z/OS C/C++ Programming Guide and Runtime Library reference.
If you open a PDS without a member name, the C library assumes that you want to open the directory.
Referring to the fldata_t C-library structure, you actually get:
__dsorgPO and _dsorgPDSdir set if you open the directory
__dsorgPO and _dsorgPDSmem set if you open a member
The ZFile.getDsorg() method returns the string "PDSmem" in the first case,
and "PDSdir" in the second.
In the new official SDK version of JZOS, getDsorg() actually returns an integer bit mask of the fldata dsorg bits, and there are constants that can be used to query bit combinations.
So, if you open a PDS directory with the C library (and ZFile), you will get
the directories DCB (RECFM=F, LRECL=256) and DSORG=PDSdir+PO.
If you open a PDS member with the C library, you will get the DCB of the members and DSORG=PDSmem+PO.
If what you want, however, is to find out the DCB attributes, the best way is to get if from the format-4 DSCB for the dataset... without opening the dataset. In MVS parlance, this is obtained using a "LOCATE". The original JZOS had an interface to LOCATE, but it was removed since it was thought to overlap function available in JRIO.
In JRIO, you can get the dataset information using something like this:
Hope this helps;
If you open a PDS without a member name, the C library assumes that you want to open the directory.
Referring to the fldata_t C-library structure, you actually get:
__dsorgPO and _dsorgPDSdir set if you open the directory
__dsorgPO and _dsorgPDSmem set if you open a member
The ZFile.getDsorg() method returns the string "PDSmem" in the first case,
and "PDSdir" in the second.
In the new official SDK version of JZOS, getDsorg() actually returns an integer bit mask of the fldata dsorg bits, and there are constants that can be used to query bit combinations.
So, if you open a PDS directory with the C library (and ZFile), you will get
the directories DCB (RECFM=F, LRECL=256) and DSORG=PDSdir+PO.
If you open a PDS member with the C library, you will get the DCB of the members and DSORG=PDSmem+PO.
If what you want, however, is to find out the DCB attributes, the best way is to get if from the format-4 DSCB for the dataset... without opening the dataset. In MVS parlance, this is obtained using a "LOCATE". The original JZOS had an interface to LOCATE, but it was removed since it was thought to overlap function available in JRIO.
In JRIO, you can get the dataset information using something like this:
Code: Select all
IRecordFile rf = new RecordFile("//MY.DATASET");
String format = rf.getRecordFormat();
int reclen = rf.getRecordLength();
int blocksize = rf.getBlocksize();
-
- Posts: 8
- Joined: Sat Aug 05, 2006 4:49 pm
I tried the following, and I got a bit of an improvement, but DSORG and BLKSIZE seem off:
creates
The real stats of this PDS are:
Organization . . . : PO
Record format . . . : FB
Record length . . . : 80
Block size . . . . : 23440
1st extent blocks . : 2
Secondary blocks . : 2
Data set name type : PDS
Code: Select all
ZFile.bpxwdyn("Alloc fi(" + DDName + ") da(" + getPDSName()
+ ") vol(" + getVolser() + ") shr");
rf = new RecordFile("//" + DDName);
info += "DSORG: " + rf.getAllocationType() + '\n';
info += "RECFM: " + rf.getRecordFormat() + '\n';
info += "BLKSIZE: " + rf.getBlockSize() + '\n';
info += "LRECL: " + rf.getRecordLength();
Code: Select all
DSORG: DEFAULT
RECFM: FB
BLKSIZE: 300
LRECL: 80
Organization . . . : PO
Record format . . . : FB
Record length . . . : 80
Block size . . . . : 23440
1st extent blocks . : 2
Secondary blocks . : 2
Data set name type : PDS
Well, I have to remember not to suggest using JRIO again
I reproduced this JRIO bug in my environment, and exchanged a couple of emails with the developer. Its apparently a bug in JRIO, although its not clear whether there is a fix available. Unfortunately, you would have to open a problem the IBM support center.
The only work around that I can think of is to open the PDS directory, and read a member name, and then open the pds with a member using ZFile. Opening a member will allow you to get the PDS DCB (opening without a member gives you the directory DCB, which is not really what you want). But it would really be best if you didn't have to open the dataset at all!
I would encourage those whe need this functionality to submit a requirement to IBM for "Catalog Search and Locate" support in JZOS; it will help to get it prioritized properly.
I reproduced this JRIO bug in my environment, and exchanged a couple of emails with the developer. Its apparently a bug in JRIO, although its not clear whether there is a fix available. Unfortunately, you would have to open a problem the IBM support center.
The only work around that I can think of is to open the PDS directory, and read a member name, and then open the pds with a member using ZFile. Opening a member will allow you to get the PDS DCB (opening without a member gives you the directory DCB, which is not really what you want). But it would really be best if you didn't have to open the dataset at all!
I would encourage those whe need this functionality to submit a requirement to IBM for "Catalog Search and Locate" support in JZOS; it will help to get it prioritized properly.