Charles Mills wrote:
Steve -
A main program cannot accept multiple parms
Really? Tell that to all of the compilers and the DFSMS utilities <g>.
Charles
Well, OK, a program invoked by JCL can only be passed a single
parm string; as Paul pointed out, this is a limitation of JCL,
not the invoked program.
-----Original Message-----
From: IBM Mainframe Discussion List [mailto:ibm-m...@bama.ua.edu] On Behalf
Of Steve Comstock
Sent: Saturday, December 26, 2009 5:28 PM
To: IBM-MAIN@bama.ua.edu
Subject: Re: argv for z/OS C++ batch
Charles Mills wrote:
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
Actually, the linkage you describe is only 'standard' for a
subroutine. Standard linkage for a main program is to be
passed a single parm, the address of a half-word prefixed string,
pointed at by R1. A main program cannot accept multiple parms,
in the sense of a list of addresses longer than one entry.
--
Kind regards,
-Steve Comstock
The Trainer's Friend, Inc.
303-393-8716
http://www.trainersfriend.com
z/OS Application development made easier
* Our classes include
+ How things work
+ Programming examples with realistic applications
+ Starter / skeleton code
+ Complete working programs
+ Useful utilities and subroutines
+ Tips and techniques
==> Ask about being added to our opt-in list: <==
==> * Early announcement of new courses <==
==> * Early announcement of new techincal papers <==
==> * Early announcement of new promotions <==
----------------------------------------------------------------------
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