On Fri, 6 Jun 2014 12:26:00 -0500, John McKown wrote:
>> >
>> >.... Check out the smart DFSORT Trick "C/C++ calls to
>> >DFSORT and ICETOOL" at
>> >
>> >http://www.ibm.com/support/docview.wss?uid=isg3T7000094
>> >
>> "JCL"? I thought that system() runs a POSIX shell. But I suppose that
>> shell could use the submit utility to submit batch JCL.
>>
>
>That's what I thought too. It turns out that on z/OS, system() has two
>modes: POSIX(ON) and ANSI (or POSIX(OFF)) mode. In POSIX(ON) it works like
>a UNIX person would expect, running UNIX programs or shell scripts by doing
>a spawn() of "/bin/sh" to run the argument command. But in ANSI mode, the
>system() uses a z/OS LINK macro to run the specified program, with an
>optional PARM which is like the JCL EXEC PARM=. Apparently the ANSI form of
>system() runs the LINK'ed to program in the same address space as the
>caller.
>
>ref:
>http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/EDCLB1C0/3.1001.3
>
Wherein I see:
The system() function has two different behaviors. These behaviors are
designated as ANSI system() and POSIX system(). The ANSI system()
behavior is based on the ISO C standard definition of the function,
whereas the POSIX system() behavior is based on the POSIX standard
definition. The ANSI system() behavior is used when a) running POSIX(OFF)
or b) when running POSIX(ON) and environment variable __POSIX_SYSTEM
is set to NO. Otherwise the POSIX system() behavior is used.
They seem to be trying to make me believe that "the ISO C standard
definition" is incompatible with "the POSIX standard definition". I
bet it's not and that the POSIX behavior is entirely compatible with
ANSI/ISO.
It's a shame that while both behaviors might be useful within a single
program, the programmer is required to choose between them with
a global setting. But does it work to run POSIX(ON) and toggle
the __POSIX_SYSTEM(YES|NO) locally about calls to system()?
IBM would have done better to make system() follow the prevailing
POSIX convention and invent a new name, e.g. __IBM_system() for
the idiosyncratic one.
-- gil
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN