Qp0zSystem()--Run a CL Command


  Syntax
 #include <qp0z1170.h>

 int Qp0zSystem( const char *CLcommand );   

  Service Program Name: QP0ZTRML

  Default Public Authority: *USE

  Threadsafe: Yes

The Qp0zSystem() function spawns a new process, passes CLcommand to the CL command processor in the new process, and waits for the command to complete. The command runs in a batch job so it does not have access to a terminal.

This function is similar to the system() function provided by ILE C, but allows a program to safely run a CL command from a multithreaded process. Note that if CLcommand fails, the global variable _EXCP_MSGID is not set with the exception message id.


Parameters

*CLcommand
(Input) Pointer to null-terminated CL command string.

Authorities

The user calling Qp0zSystem() must have *USE authority to the specified CL command.


Return Value

0 The specified CL command was successful.
1 The specified CL command was not successful.
-1 Qp0zSystem() was not successful.


Related Information


Example

The following example shows how to use the Qp0zSystem() function to create a library.

Note: By using the code examples, you agree to the terms of the Code license and disclaimer information.

#include <stdio.h>
#include <qp0z1170.h>

int main(int argc, char *argv[])
{
  if (Qp0zSystem("CRTLIB LIB(XYZ)") != 0)
    printf("Error creating library XYZ.\n");
  else
    printf("Library XYZ created.\n");

  return(0);
}


Output:

    Library XYZ created


API introduced: V4R2

[ Back to top | UNIX-Type APIs | APIs by category ]