Run an i5/OS PASE program with QP2SHELL()

You use QP2SHELL or QP2SHELL2 programs to run an i5/OS™ PASE program from any i5/OS command line and within any high-level language program, batch job, or interactive job.

These programs run an i5/OS PASE program in the job that calls it. The name of the i5/OS PASE program is passed as a parameter on the program.

The QP2SHELL() program runs the i5/OS PASE program in a new activation group. The QP2SHELL2() program runs in the caller's activation group.

The following example runs the ls command from the i5/OS command line:

call qp2shell parm('/QOpenSys/bin/ls' '/')

If you pass values into QP2SHELL() using CL variables, the variables must be null-terminated. For example, you need to code the above example in the following way:

PGM  DCL  VAR(&CMD)    TYPE(*CHAR)   LEN(20)    VALUE('/QOpenSys/bin/ls')
DCL  VAR(&PARM1)  TYPE(*CHAR)   LEN(10)    VALUE('/')
DCL  VAR(&NULL)   TYPE(*CHAR)   LEN(1)     VALUE(X'00')

                   CHGVAR VAR(&CMD) VALUE(&CMD *TCAT &NULL)
                   CHGVAR VAR(&PARM1) VALUE(&PARM1 *TCAT &NULL)

                   CALL PGM(QP2SHELL) PARM(&CMD &PARM1)
    
ENDIT:
ENDPGM
Related information
QP2SHELL() and QP2SHELL2()--Run an i5/OS PASE Shell Program