?
Solved

C/C++ for MVS: How do I read the master catalog?

Posted on 2009-04-30
9
Medium Priority
?
1,501 Views
Last Modified: 2012-08-13
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.

IBMUSER:/u/ibmuser: >uname -a
OS/390 ADCD 16.00 03 9121
0
Comment
Question by:cvaduva
  • 5
  • 4
9 Comments
 
LVL 57

Expert Comment

by:giltjr
ID: 24268945
Um, are you the (or one of the) system programmers?  If you are not, then I would strongly suggest you start talking to them.

I kind of suspect you are not a system programmers, as the system programmer would know what the master catalog name is without looking at syscatlg.  However you are running a AD/CD system, which are supposed to be "turnkey" system and system programmers are not (in theory) supposed to be needed.

I personally would have to do some research to figure this out, I am a system programmers but I deal with networking side of the house normally.
0
 
LVL 57

Expert Comment

by:giltjr
ID: 24269151
Also, how are you planning to run this program?

Under CICS, TSO, straight batch, Unix System Services, or something else?
0
 

Author Comment

by:cvaduva
ID: 24269293
I want to run it from USS
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 57

Expert Comment

by:giltjr
ID: 24270191
Do you really want to read the master catalog, or do you want to be able to get a list of data sets based on a prefix?

From Unix System Services you should be able to call TSO services from C++ and use the LISTCAT LEVEL function.

If you get into Unix System Services from a command prompt you can do:

     tso "listcat level('sys1')"

to get an idea of what the output will be like.  I really don't think you want to be walking the master catalog itself.  I'm checking to see if there are any of the catalog routines that are directly callable from Unix System Services without using TSO and  LISTCAT.

0
 

Author Comment

by:cvaduva
ID: 24270303
Yes, I know of tso listcat, but I need to do that from C to read the catalog structure and display it however I like.
I searched alot and I don't believe there's a function to do that.
I was thinking of assembly code - calling some SVC..
0
 
LVL 57

Accepted Solution

by:
giltjr earned 2000 total points
ID: 24270826
O.K., I'm not a C++ programmer.  But you should be able to use IGGCSI00, which is a IBM supplied Catalog Search routine.

This is typically called from Assemble or REXX (there are samples in SYS1.SAMPLIB with member names IGGCSIxx).  However according to the manual you can call IGGCSI00 from a higher level language as long as the higher level language invokes IGGCSI00 using an assember language CALL with V-type address, LINK, or LOAD and CALL.

I would assume that C++ allows you to invoke/call/link other routines using these.

You can call TSO subroutines from C++ and just parse the output of the LISTCAT command.  Execpt for VSAM files there is not a whole lot of information in a catalog entry, bascially the file name, sms class names, and volume names.

Although EE is great, there are not a whole lot of z/OS (or other IBM "z" operating systems) experts here.  You may want to join the list server group IBM-Main (http://alabamamaps.ua.edu/archives/ibm-main.html) and post the question there.  There are plenty of people there that would know if this could be done and how to do it.
0
 

Author Comment

by:cvaduva
ID: 24276769
I posted the question on http://alabamamaps.ua.edu/archives/ibm-main.html and there were many answers.
Thanks so much :)
0
 

Author Closing Comment

by:cvaduva
ID: 31576328
The solution would be to use the free catsearch tool ( http://dovetail.com/docs/coz/dsp-ref_catsearch.html ) or implement something similar.

Thanks for the help.
Best regards
0
 
LVL 57

Expert Comment

by:giltjr
ID: 24278438
Since the ls command does not show the DCB information, you might want to look at the source code and figure out how to call IGGCSI00 your self.  That way you don't waste the time/cpu cycles going out to read the VTOC for every file you want to list.

Glad to have been some help.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When writing generic code, using template meta-programming techniques, it is sometimes useful to know if a type is convertible to another type. A good example of when this might be is if you are writing diagnostic instrumentation for code to generat…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.
Suggested Courses

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question