z/OS Using REXX and z/OS UNIX System Services
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


forkexecm

z/OS Using REXX and z/OS UNIX System Services
SA23-2283-00

Read syntax diagramSkip visual syntax diagram
>>-forkexecm--program--+------+--------------------------------><
                       '-parm-'   

Function

forkexecm invokes the fork and execmvs callable services to fork and exec a program to be executed from the LINKLIB, LPALIB, or STEPLIB library.

Parameters

program
The name of the program.
parm
A parameter to be passed to the program.

Usage notes

  1. If the exec fails, the child process ends with a SIGABRT signal.
  2. If the fork succeeds, RETVAL contains the PID for the child process.
  3. The child process has a unique process ID (PID) that does not match any active process group ID.
  4. If a hierarchical file system (HFS) file has its FCTLCLOFORK flag set on, it is not inherited by the child process. This flag is set with the fcntl callable service.
  5. The process and system utilization times for the child are set to zero.
  6. Any file locks previously set by the parent are not inherited by the child.
  7. The child process has no alarms set (similar to the results of a call to the alarm service with Wait_time specified as zero).
  8. The child has no pending signals.
  9. The following characteristics of the calling process are changed when the new executable program is given control by the execmvs callable service:
    • The prior process image is replaced with a new process image for the executable program to be run.
    • All open files marked close-on-exec and all open directory streams are closed.
  10. The input passed to the MVS™ executable file by the service is consistent with what is passed as input to MVS programs. On input, the MVS program receives a single-entry parameter list pointed to by register 1. The high-order bit of the single parameter entry is set to 1.

    The single parameter entry is the address of a 2-byte length field followed by an argument string. The length field describes the length of the data that follows it. If a null argument and argument length are specified in the call, the length field specifies 0 bytes on input to the executable file.

  11. The call can invoke both unauthorized and authorized MVS programs:
    • Unauthorized programs receive control in problem program state, with PSW key 8.
    • Authorized programs receive control in problem program state, with PSW key 8 and APF authorization.
  12. The TASKLIB, STEPLIB, or JOBLIB DD data set allocations that are active for the calling task at the time of the call to the execmvs service are propagated to the new process image, if the data sets they represent are found to be cataloged. Uncataloged data sets are not propagated to the new process image. This causes the program that is invoked to run with the same MVS program search order as its invoker.

Example

In the following example, assume that pgm was assigned a value earlier in the exec:
"forkexecm (pgm) 'hello world'"

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014