How to compile/link/run a C/C++ program with JCL?



Help for C/C++ for MVS, OS/390 C/C++, z/OS C/C++ and C/C++ Productivity Tools for OS/390

How to compile/link/run a C/C++ program with JCL?

Postby chan » Thu Dec 20, 2012 4:21 am

Could anyone give me a minimal example of how to compile/link/run a simple C++ program (Hello World says) using JCL? I read the documentation from IBM but it was way too complex. They listed so many options that confused me. Thanks in advance.
chan
 
Posts: 10
Joined: Wed Dec 19, 2012 3:00 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How to compile/link/run a C/C++ program with JCL?

Postby steve-myers » Thu Dec 20, 2012 5:16 am

steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: How to compile/link/run a C/C++ program with JCL?

Postby chan » Thu Dec 20, 2012 5:27 am

Hi Steve,
Sorry posting a very similar question, but I honestly read that. But at the moment, with my limited knowledge, I really don't quite understand all of that. To me, an example would be a tremendous help since from there I can perform trial-error to see what works what does not.
I'm currently working alone on the Marist z/OS, just a research project for one of my professors, and I'm not studying at Marist College. No one in my school have any knowledge about mainframe whatsoever. So it's really frustrated to look for help, especially during this Winter break. I hope you understand my situation.
chan
 
Posts: 10
Joined: Wed Dec 19, 2012 3:00 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How to compile/link/run a C/C++ program with JCL?

Postby steve-myers » Thu Dec 20, 2012 9:04 am

If you are going to use z/OS you must learn some JCL. It really is not all that hard - though I must admit I've been using it for more than 40 years. My response to your initial post suggested you look at several possible cataloged procedures, which you can easily do with ISPF. Most compiler oriented cataloged procedure imply their purpose in the characters at the end of the procedure name.
  • C - The procedure will compile a program
  • L - The procedure will lin kedit a program
  • G - The procedure will execute ("go")a program
So a procedure xxxCLG will compile, link edit, and execute a program. Something like xxxCG will compile, and in one step run a linking loader and execute a program.

A "linking loader," which is probably a strange concept to you, prepares executable code in storage without preparing a load module. The idea has been around for a long time in mainframes because the mainframe linkage editor was fairly slow, and the overhead to run a separate linkage editor step was very high. A few software vendors came up with the idea of a linking loader, and IBM produced its own, which kind of blew the vendor provided linking loaders out of the water. In the 1990s, when IBM replaced the 1960s derived linkage editor with the Binder, rather than continue with a linking loader as a separate program, as was done in the 1960s, the linking loader was included with the Binder, though it appears to be a separate program.

In most shops, the IBM procedures, along with many shop specific procedures are in a data set called 'SYS1.PROCLIB. Look there first.

These users thanked the author steve-myers for the post:
chan (Thu Dec 20, 2012 10:38 am)
steve-myers
Global moderator
 
Posts: 2105
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 243 times

Re: How to compile/link/run a C/C++ program with JCL?

Postby chan » Thu Dec 20, 2012 10:37 am

Hi Steve,
Thanks a lot, I will definitely go over all those things you mentioned above. By the way, could you suggest me some good books for z/OS and JCL?
chan
 
Posts: 10
Joined: Wed Dec 19, 2012 3:00 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How to compile/link/run a C/C++ program with JCL?

Postby delorimier » Thu Dec 20, 2012 11:04 am

chan wrote:By the way, could you suggest me some good books for z/OS and JCL?

You may look at this one: Gary DeWard Brown, z/OS JCL, Fifth Edition (Wiley, 2002).
delorimier
 
Posts: 9
Joined: Sat Aug 25, 2012 7:01 am
Has thanked: 0 time
Been thanked: 0 time


Return to C, C++

 


  • Related topics
    Replies
    Views
    Last post