System i: Programming i5/OS PASE - IBM
System i: Programming i5/OS PASE - IBM
System i: Programming i5/OS PASE - IBM
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
CHGVAR VAR(&CMD) VALUE(&CMD *TCAT &NULL)<br />
CHGVAR VAR(&PARM1) VALUE(&PARM1 *TCAT &NULL)<br />
CALL PGM(QP2SHELL) PARM(&CMD &PARM1)<br />
ENDIT:<br />
ENDPGM<br />
Related information<br />
QP2SHELL() and QP2SHELL2()--Run an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> Shell Program<br />
Running an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program with QP2TERM()<br />
You use this <strong>i5</strong>/<strong>OS</strong> program to run an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program in an interactive shell environment.<br />
Start an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> interactive terminal session with the QP2TERM() program.<br />
The following command writes the default Korn shell prompt (/QOpenSys/usr/bin/sh) to the screen:<br />
call qp2term<br />
From this prompt, you run an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program in a separate batch job. QP2TERM() uses the<br />
interactive job to display output and to accept input for files stdin, stdout, and stderr in the batch job.<br />
The Korn shell is the default, but you can optionally specify the path name of any <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program<br />
that you want to run, as well as any argument strings to pass to the program.<br />
You can run any <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program and any of the utilities from the interactive session that you start<br />
with QP2TERM(); stdout and stderr are written and scrolled in the terminal screen.<br />
Related concepts<br />
“<strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> shells and utilities” on page 56<br />
<strong>i5</strong>/<strong>OS</strong> Portable Application Solutions Environment (<strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong>) includes three shells (Korn, Bourne, and<br />
C shell) and provides many utilities that run as <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> programs. <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> shells and utilities<br />
provide an extensible scripting environment that includes a large number of industry-standard and<br />
defacto-standard commands.<br />
Related information<br />
QP2TERM()--Run an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> Terminal Session<br />
Running an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program from within <strong>i5</strong>/<strong>OS</strong> programs<br />
You can call the Qp2CallPase() and Qp2CallPase2() ILE procedures from within other ILE procedures to<br />
start and run an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program.<br />
Use the Qp2RunPase() API to run an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program. You specify the program name, argument<br />
strings, and environment variables.<br />
The Qp2RunPase() API runs an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program in the job where it is called. It loads an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong><br />
program (including any necessary shared libraries) and then transfers control to the program.<br />
This API gives you more control over how <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> runs than QP2SHELL() and QP2TERM().<br />
Related information<br />
Qp2RunPase()--Run an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> Program<br />
Examples: Running an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program from within <strong>i5</strong>/<strong>OS</strong> programs:<br />
These examples show an ILE program that calls an <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program, and the <strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> program<br />
that is called by the ILE program.<br />
Note: By using the code examples, you agree to the terms of the “Code license and disclaimer<br />
information” on page 70.<br />
<strong>i5</strong>/<strong>OS</strong> <strong>PASE</strong> 21