IBM Books

Administration and Programming Guide for OS/400

Issuing Commands and Calling Programs

To issue a command, define a function that uses the System (DTW_SYSTEM) language environment that includes a path to the command to be issued in an EXEC statement. For example:

%FUNCTION(DTW_SYSTEM) sys1() {
      %EXEC { /QSYS.LIB/ADDLIBLE.CMD LIB(MYLIBRARY) %}
 %}

You can shorten the path to executable objects if you use the EXEC_PATH configuration variable to define paths to directories that contain the objects (such as, commands and programs). See EXEC_PATH to learn how to define the EXEC_PATH configuration variable.

Example 1: Issues a command

%FUNCTION(DTW_SYSTEM) sys2() {
      %EXEC { /QSYS.LIB/CALL.CMD MYLIB/MYPGM %}
 %}

Example 2: Calls a program

%FUNCTION(DTW_SYSTEM) sys3() {
      %EXEC { /QSYS.LIB/MYLIB.LIB/MYPGM.PGM %}
 %

Tip: When calling programs, use the Direct Call language environment because it is more efficient and easier to use.


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]