IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to compile & run C++ programs in z\os


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Padmanabharao Pokuri

New User


Joined: 29 Jun 2011
Posts: 5
Location: Eden Prairie

PostPosted: Mon Aug 01, 2011 11:56 pm
Reply with quote

Hi,

I have C++ program on z\OS

EDIT hello.cpp
Command ===>
****** ***************************** Top of Data *******
000001 #include <iostream>
000002 int main( int argc, char **argv )
000003 {
000004 std::cout << "Hello World" << std::endl;
000005 return 0;
000006 }
****** **************************** Bottom of Data *****

Could anybody suggest step by step how to compile & run above program in z\OS environment.

Thank you
Pokuri
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Aug 02, 2011 12:10 am
Reply with quote


  • Go to you colleagues
  • Ask them
  • Follow their advice
Back to top
View user's profile Send private message
Padmanabharao Pokuri

New User


Joined: 29 Jun 2011
Posts: 5
Location: Eden Prairie

PostPosted: Tue Aug 02, 2011 12:17 am
Reply with quote

Thanks for you time. I tried with my colleagues but no use. Finally i posted.
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Tue Aug 02, 2011 12:25 am
Reply with quote

Let us discuss this problem a little:
  1. Given that none of your colleagues have any idea of how to compile a C++ program, is this the first instance of the use of C++ in your shop?
  2. If this is the first instance of its use, are you (or is anyone) actually authorized to use C++, or is the end result of this venture going to be you sliding along the sidewalk, a pink slip in your hand and a footprint on your arse?
  3. If you are authorized to use C++, why have not your system programmers provided you with the necessary suite of tools and the documentation to use and understand them?
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Tue Aug 02, 2011 12:26 am
Reply with quote

Quote:
I tried with my colleagues but no use.


Well, remarkably, I didn't know that.

It is possible that this is something you are not supposed to do.

Do you know any of the techies? Did you check with you boss?

You got a PC at home? You can learn C++ on that.

If you are allowed to do it, but no-one knows how(!) you can probably get it from a manual.

Just make sure you are allowed to do it first.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Tue Aug 02, 2011 1:13 am
Reply with quote

Hello,

Does anyone on the system know how to compile a COBOL program? The process will be quite similar for c++ (assuming the compiler is installed and you are permitted to use it).

Suggest you speak with the prople who support the standard COBOL compile/link process(es) to help set up what you need. It will be site-specific.
Back to top
View user's profile Send private message
mtaylor

Active User


Joined: 20 Feb 2009
Posts: 108
Location: Kansas City

PostPosted: Thu Aug 04, 2011 9:47 am
Reply with quote

I used to try and do that, you can usually run 'cc' from the omvs prompt. The problem comes when specifying the linker args for anything other than stdlib.h (it seemed to link by default); I could never find the include dirs. There are c/c++ programming guide/lang reference in the ibm manuals, you should be able to piece it all together from those.

You also might want to think about switching to a job that let's you work with newer tech though, there's a place for people with your curiosity and enthusiasm 'outside the box' and it's rarely in mainframe shops (imo).
Back to top
View user's profile Send private message
PeterHolland

Global Moderator


Joined: 27 Oct 2009
Posts: 2481
Location: Netherlands, Amstelveen

PostPosted: Thu Aug 04, 2011 10:57 am
Reply with quote

JCL examples are to be found in :

z/OS XL C/C++Programming Guide SC09-4765
Back to top
View user's profile Send private message
Ed Goodman

Active Member


Joined: 08 Jun 2011
Posts: 556
Location: USA

PostPosted: Thu Aug 04, 2011 9:01 pm
Reply with quote

This still confuses me a bit. I know that there is some Operating System called "Z/OS something" that looks a lot like a Linux box. It has all the bells ans whistles you'd see on a Linux server, like Java man pages and shell environments.

Then there is the COBOL-style "Z/OS something" where programs like TSO and IMS and VSAM live.

When I see a question like this one, I know that I have compiled and run programs written in C++ in the same universe where my COBOL programs live. The compile JCL looks similar and the program lives in a normal PDS as an executable load module.

However, I wonder if this TS is running in a Linux universe. Would the folks reading this be able to tell?
Back to top
View user's profile Send private message
Padmanabharao Pokuri

New User


Joined: 29 Jun 2011
Posts: 5
Location: Eden Prairie

PostPosted: Thu Aug 04, 2011 10:23 pm
Reply with quote

Thanks for all.
I am able to compile & run the program in OMVS.

000001 //
000002 // Sample Program: Hello World
000003 #include <iostream>
000004 using namespace std;
000005 int main()
000006 {
000007 cout << "Hello World \n";
000008 return 0;
000009 }

:/u/pokuri: >./hello
Hello World

But i am not able to compile & run the same program thru Batch Job (JCL) in TSO environment.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Thu Aug 04, 2011 10:50 pm
Reply with quote

I believe the default name -- which can be changed when installed at a site -- for the PDS with the compile JCL is CBC.SCCNPRC and the member would be CBCCB or CBCCL depending upon whether you are binding or prelinking/linking.

If you can compile in OMVS, you can use BPXBATCH to do the same in a batch job.

As always, contact your site support group for assistance since the compile process depends very much upon the specifics of the site and how their standard compile processes are put together.
Back to top
View user's profile Send private message
Padmanabharao Pokuri

New User


Joined: 29 Jun 2011
Posts: 5
Location: Eden Prairie

PostPosted: Fri Aug 05, 2011 2:01 am
Reply with quote

I am able to compile in OMVS and run batch job using BPXBATCH.
But Now i am trying to compile & Run thru Batch job using CBC.SCCNPRC.
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10888
Location: italy

PostPosted: Fri Aug 05, 2011 12:24 pm
Reply with quote

Quote:
But Now i am trying to compile & Run thru Batch job using CBC.SCCNPRC.


and... where is the question ?
Back to top
View user's profile Send private message
Padmanabharao Pokuri

New User


Joined: 29 Jun 2011
Posts: 5
Location: Eden Prairie

PostPosted: Sat Aug 06, 2011 1:38 am
Reply with quote

Thanks for all your help.
Now i am able to run the C++ programs in TSO environment thru Batch job.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sat Aug 06, 2011 9:15 am
Reply with quote

Good to hear it is working - thank you for letting us know icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Compile Sp Cobol base COBOL Programming 1
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts C Compile time time stamps Java & MQSeries 10
No new posts Fetch data from programs execute (dat... DB2 3
Search our Forums:

Back to Top