Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics
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    Post subject: How to compile & run C++ programs in z\os
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Aug 02, 2011 12:10 am    Post subject: Reply to: How to compile & run C++ programs in z\os
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    Post subject: Re: Reply to: How to compile & run C++ programs in z\os
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: 1738
Location: Bloomington, IL

PostPosted: Tue Aug 02, 2011 12:25 am    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Aug 02, 2011 12:26 am    Post subject: Reply to: How to compile & run C++ programs in z\os
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

Site Director


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

PostPosted: Tue Aug 02, 2011 1:13 am    Post subject:
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    Post subject:
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: 2422
Location: Netherlands, Amstelveen

PostPosted: Thu Aug 04, 2011 10:57 am    Post subject:
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    Post subject:
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    Post subject:
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: 7904
Location: Bellevue, IA

PostPosted: Thu Aug 04, 2011 10:50 pm    Post subject:
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    Post subject:
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

Global Moderator


Joined: 14 Mar 2007
Posts: 10201
Location: italy

PostPosted: Fri Aug 05, 2011 12:24 pm    Post subject: Reply to: How to compile & run C++ programs in z\os
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    Post subject:
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

Site Director


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

PostPosted: Sat Aug 06, 2011 9:15 am    Post subject: Reply to: How to compile & run C++ programs in z\os
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    IBMMAINFRAMES.com Support Forums -> All Other Mainframe Topics All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm
No new posts COBOL 5 Compile oerdgie COBOL Programming 3 Thu Oct 06, 2016 6:14 pm
No new posts User exit in COBOL programs ganasrinivasan PL/I & Assembler 0 Thu Aug 18, 2016 12:48 pm
No new posts compile and link program in 6.1 brigitte pruett COBOL Programming 3 Tue Aug 16, 2016 12:09 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us