About cookies on this site Our websites require some cookies to function properly (required). In addition, other cookies may be used with your consent to analyze site usage, improve the user experience and for advertising. For more information, please review your options. By visiting our website, you agree to our processing of information as described in IBM’sprivacy statement. To provide a smooth navigation, your cookie preferences will be shared across the IBM web domains listed here.
Troubleshooting
Problem
When using UNIX System Services Assembler Callable Services for spawn (BPX1SPN, BPX4SPN) or exec (BPX1EXC, BPX4EXC) to directly invoke the z/OS /bin/sh shell, input arguments may not be correctly parsed.
Symptom
If C-style invocation is not used, the shell will be invoked but may not parse input arguments as expected.
The primary symptom of this scenario is missing input parameters often encountered when attempting to invoke the shell to run a shell script requiring inputs.
Pathname of "/bin/sh"
argument_list of "-c", "/path/to/myscript.sh", and "script inputs"
Users may find the "script inputs" text expected to be passed to 'myscript.sh' is missing when 'myscript.sh' runs.
Cause
This occurs when /bin/sh is parsing arguments and is not invoked using a C-style argument list. The shell may not correctly parse all arguments.
Environment
This applies to users of the UNIX System Services Assembler Callable Services for spawn (BPX1SPN, BPX4SPN) or exec (BPX1EXC, BPX4EXC) invoking /bin/sh.
Resolving The Problem
To resolve this problem, adhere to the C-style spawn()/exec() invocation syntax; both pathname and arglist[0] should be "/bin/sh".
Refer to the documentation for C Runtime spawn() or C Runtime exec().
Specifically (using spawn() as a reference):
path (spawn input 1)
| Path name used by spawn() that identifies the new process image file to execute.
argv (spawn input 5)
| The value in the first element of argv should point to a file name that is associated with the process being started by the spawn() or spawnp() operation.
Following this (C-style) format, the shell gets invoked with:
pathname = /bin/sh and argv[0] = /bin/sh, argv[1] = -c, argv[2] = scriptname with args
and the script receives the input args as expected.
instead of the failing scenario:
pathname = /bin/sh and argv[0] = -c, argv[1] = scriptname, argv[2] = script args
where argv[2] fails to get parsed and the script gets invoked with no input args.
Document Location
Worldwide
[{"Type":"MASTER","Line of Business":{"code":"LOB56","label":"Z HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG90","label":"z\/OS"},"ARM Category":[{"code":"a8m0z0000000AIRAA2","label":"z\/OS-\u003EUSS Shell \u0026 Utilities"}],"ARM Case Number":"TS014665317","Platform":[{"code":"PF035","label":"z\/OS"}],"Version":"All Versions"}]
Was this topic helpful?
Document Information
More support for:
z/OS
Component:
z/OS->USS Shell & Utilities
Software version:
All Versions
Operating system(s):
z/OS
Document number:
7150586
Modified date:
09 May 2024
UID
ibm17150586
Manage My Notification Subscriptions