问题
How to read the size of the member of a pds file. A pds file has many members. If we browse a pds we can see the member names, their creation date, time user, size, etc. So how to get these attributes separately in variables.
回答1:
As Bruce mentioned LMMFIND will have the ISPF statistics for a PDS member. Make sure to use the STATS YES on the service. Also, you may need to check for extended stats (variable ZLEXT ). A site may chose to use extended stats if the member size exceeds 64K. Please refer to the ISPF services Guide. Below is the link for LMMFIND in the 2.1 manual.
https://www.ibm.com/support/knowledgecenter/SSLTBW_2.1.0/com.ibm.zos.v2r1.f54sg00/lmmfind.htm%23lmmfind
回答2:
If running under TSO/ISPF (you can do this in batch as well), you can use the LMMFIND service with the stats(yes) option. You will have to do
- lminit
- lmopen
before you do the LMFIND. Also as zarchasmpgmr you will need to do LMCLOSE and LMFREE
If you want to display a member list, have a look at LMMDISP
回答3:
Be aware that the statistics you write about are maintained by ISPF. There are many ways to create a member outside of ISPF, and those members will not have those statistics. The ISPF service LMMSTATS will set those stats (the 3.5 R panel is a front end to that service). The order of calls is
- LMINIT
- LMMSTATS
- LMFREE
For some reason, LMMSTATS doesn't require the LMOPEN and LMCLOSE services.
回答4:
It's been ages, but if the PDS does not have ISPF stats (or the STATS are dubious (eg they can be changed outside of ISPF)). Then you could look to processing the directory.
However, by default a PDS directory doesn't contain that much info, so unless ISPF stats exist you couldn't get much info. What a PDS directory does have is a user-definable area and it's that area hat ISPF utilises. This area is preceeded by a length descriptor (see link for more info).
Another reason why ISPF stats may not exists or be accurate, is that, I think (if I recall correctly), that you can remove the stats, which can free some directory space (potentially get around E37 Abend or circumvent it happening).
I can't recall having tried with Rexx (did write an Assembler PDS unload utility), but you might be able to open and read the directory using EXECIO on the BASE name of the PDS (ie not including (member)).
The directory is blocked at 256 bytes. More info in regards to the structure can be found here PDS Directory. I don't believe that this would work properly for PDSE's though.
来源:https://stackoverflow.com/questions/36180974/read-the-size-of-the-member-of-the-pds