10 pts.
 C/C++ for MVS: Reading the master catalog
I'm trying to get the same output as "ls '*'" from z/OS FTPD. I think this can be done by reading the master catalog. Until now I found no way to open it from C. I found out that the master catalog path is in SYS1.NUCLEUS(SYSCATLG). It says: S6SYS1113CCATALOG.Z16S.MASTER So, my master catalog is CATALOG.Z16S.MASTER. I thought I could be able to open it with fopen, but it doesn't work. Am I missing something? Any help is appreciated. IBMUSER:/u/ibmuser: >uname -a OS/390 ADCD 16.00 03 9121

Software/Hardware used:
ASKED: April 17, 2009  1:12 PM
UPDATED: August 9, 2010  7:56 PM

Answer Wiki:
You're quite correct in saying that sys1.nucleus(syscatlg) points to the master catalog. However most sites only have system datasets in their master catalog. All other datasets are in a handful of user catalogs (which are also cataloged in the master catalog). Also remember that catalogs are used for traditional z/OS datasets, and not for UNIX Systems Services (USS) files. I'm assuming that you want to list traditional z/OS datasets (otherwise, you could simply open and read the USS directory). This has always been a bit of a difficult problem to solve for z/OS programmers. z/OS provides the macros LOCATE and CAMLST to create parameter lists and call the Catalog access services (documented in the DFSMSdfp Advanced Services manual). You could look at these macros and convert them to C/C++. However this will be quite difficult. Unfortunately, I can't find any C/C++ runtime functions to do the same thing. The other option is to look at some freeware sites to see if anyone else has done this. Go to this <a href="http://www.longpelaexpertise.com.au/links">link page</a>, and hop down to the Freeware & Downloads section for a good list. Hope this helps.
Last Wiki Answer Submitted:  April 21, 2009  1:05 am  by  Dzs   235 pts.
All Answer Wiki Contributors:  Dzs   235 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Why not use normal MVS (z/OS) commands to access your catalog? Things like LISTCAT come to mind. Output to a dataset. Then use your program (written in C or whatever) to read the dataset.

 5,205 pts.