Sign in

docs Examples

shellrc

shellrc

              /* This program shows an example of calling a PASE program */
              /* and getting its return code using the CEE4GETRC API     */
              /* from an ILE CL program.                                 */
              PGM

              /* Parameters for CEE4GETRC                                */ 
              DCL        VAR(&RC) TYPE(*INT) LEN(4) VALUE(0)

              /* Buffer to hold the output message                       */
              DCL        VAR(&MSG) TYPE(*CHAR) LEN(10)

              /* This can be any program. bsh is used here, since it's   */
              /* always installed and can be relied on.                  */
              CALL       PGM(QP2SHELL) +
                           PARM('/QOpenSys/usr/bin/bsh' '-c' 'exit 42')

              /* Call the ILE CEE4GETRC procedure. All parameters are    */
              /* passed by reference (default).                          */
              CALLPRC    PRC(CEE4GETRC) PARM((&RC *BYREF) (*OMIT))

              /* Print out the return code from the application          */
              CHGVAR     VAR(&MSG) VALUE('RC = ' *BCAT %CHAR(&RC))
              SNDPGMMSG  MSG(&MSG)

              ENDPGM