Skip to main content development
   toolset
 
  Easy400   |       iSeries home
Public-Source
 
Introduction
Tutorial
Examples
FAQ
Index
Download
 
 

 
2.4 - Execute a command


One of the most important procedures in service program cgicbldev2/cgicbldev2 is QDOCMD, which allows to execute a command.

Through the use of this procedure, one can write ILE-COBOL programs that perform most of the duties usually expected from CL programming.

  •  QDoCmd  - Execute a command
    Use this procedure to execute a command.
    It returns a binary return code:
    • "0" if the command was successful
    • "-1" if the command failed
    The following parameter must be passed:
    • command to be executed (char 2000)

    Example of executing a command:
            ...         ...         ...
           SPECIAL-NAMES.
                 copy CPYSPCNAME of CGICBLDEV2-QCBLLESRC.
            ...         ...         ...
      * Variables to execute a command
           05     rc                  PIC  S9(9) comp-4 value 0.
           05     cmd                 PIC  X(2000).
            ...         ...         ...
      * Override the database file and open it
           move 'ovrdbf myfile mylib/myfile secure(*yes)' to cmd
           call 'QDOCMD' using cmd
                         returning into rc.
           open input myfile.





  •     Contact