REXX Tips & Tricks, Version 2.80


Inf-HTML [About][Toc][Index] 0.9b (c) 1995 Peter Childs


Get the parameter as seen by CMD.EXE





 
/*                                                                    */
/* sample REXX code to show how to get the parameter without          */
/* using the REXX functions (and therefore avoiding the restrictions  */
/* of the REXX interpreter)                                           */
/*                                                                    */
/* Caution: This code works only for REXX programs called from        */
/*          CMD.EXE - not for REXX programs called from other         */
/*          REXX programs!                                            */
/*                                                                    */

                    /* check if this program was called as COMMAND    */
                    /* or as SUBROUTINE                               */
  parse source . callType .
  if callType <> "COMMAND" then
  do
    say "Error: This method only works if this program was" ,
        "called from the command line!"
    exit
  end /* if callType <> "COMMAND" then */

                    /* flush the REXX queue                           */
  do while queued() <> 0; parse pull; end

                    /* copy the parameters 1 to 9 into the queue      */
  '@ECHO %1 %2 %3 %4 %5 %6 %7 %8 %9| rxqueue'
                    /* get the parameter via the alternate method     */
  parse pull CMDparameter
  CMDParameter = strip( CMDParameter )

                    /* get the parameter via the REXX features        */
  parse arg REXXParameter

  say 'Parameter retrieved with PARSE ARG are:       "' || REXXParameter || '"'
  say 'Parameter retrieved via alternate method are: "' || CMDparameter || '"'
exit 0

  

Inf-HTML End Run - Successful