Sam -

Thanks and thanks.

I'm trying to write a C++ program that will allow "standard" z/OS utility
linkage. It wants to look as much as possible like other programs that
expect a parm 1 and a parm 2 passed via R1 -> words 0 and 1.

I can do whatever I want on the C++ side but I would like the caller to be
able to use "standard" linkage.

The C++ program is big and involved and I really can't afford to give up the
C/C++ library.

I just ran an experiment and determined two things:

1. The C++ program can be loaded via "standard" assembler macros absent any
CEE routines with no problems. I used LINKMVS from Rexx because it was easy
to do.

2. However ... argv[0] = the C program's name; argv[1] = the first parameter
passed on LINKMVS; the second parameter was nowhere to be found. This is a
problem.

I see writing an assembler stub to get control first, establish the LE
environment, and then call the C++ main (or a "pseudo-" main), passing the
two arguments somehow, probably as a list passed as argv[1]. 

Does anyone know an easier way? Seems like a pretty obvious need: write a
C++ program that starts up with standard z/OS
multiple-parameter-pointers-pointed-to-by-R1 linkage.

Charles

-----Original Message-----
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On Behalf
Of Sam Siegel
Sent: Saturday, December 26, 2009 4:55 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: argv for z/OS C++ batch

Charles,

The other option you have is to look at METAL C or system C.  Or a third
party compiler.

Regards,
Sam

On Sat, Dec 26, 2009 at 9:14 PM, Charles Mills <charl...@mcn.org> wrote:

> Trying to figure out this subject.
>
>
>
> The C/C++ Language Reference on p. 207 says "Under z/OS batch . argv[0]
> Returns the program name in uppercase argv[1 to n] Returns the arguments
as
> you enter them." Not the most useful documentation - I don't think "as you
> enter them" is terribly clear as it pertains to z/OS batch.
>
>
>
> The C/C++ User's Guide on p. 70 says "When NOARGPARSE is in effect,
> arguments on the invocation line are not parsed, argc has a value of 2,
and
> argv contains a pointer to the string."
>
>
>
> Question: Does anyone know if a NOARGPARSE C++ program called via LINK or
> ATTACH would receive parm 2 - the second word pointed to by R1 - anywhere?
> Is there a recommended way to do this?
>
>
>
> What I'd like to end up with is a C program that "did me no favors" - if
> invoked from JCL EXEC, then argv[1] would point to the PARM= string if any
> ("as is") and if called via LINK or ATTACH would get the vector pointed to
> by the caller's R1 as argv[1, 2, 3 .].

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@bama.ua.edu with the message: GET IBM-MAIN INFO
Search the archives at http://bama.ua.edu/archives/ibm-main.html

Reply via email to