Passing arguments and calling programs (Beginning level) Contributed by: Doug Rickman, Global Hydrology and Climate Center, MSFC, NASA This is aimed at beginning REXX users. ------------------------------------------------------------------------ /*****************************************************************************/ /*************** Passing Arguments and Calling Programs *********************/ /* In the calling routine the format is */ /* Call SomeRoutine arg1a arg1b , arg2, arg3 ... or it is */ /* rc=SomeRoutine(arg1a arg1b,arg2,arg3,...) */ /* These translate into English as pass arg1a and arg1b as a single string */ /* to the subroutine and arg2 and arg3 as separate strings. */ /* Note that the first form always places any 'RETURN'ed value in 'RESULT'. */ /* If there is no value returned there is no problem. The second form MUST */ /* have something returned. */ /* You can pass multiple input arguments to the program. Of course, only one*/ /* argument can be returned from the program, though that one argument can */ /* be a string. */ /* In the called program to bring in an argument without change to case use */ /* "parse arg a b c ... */ /* Note that this is parsing argument 1! */ /* arguments can be accessed by doing */ /* Variable1=arg(1) */ /* Variable2=arg(2) */ /* Variable3=arg(3) */ /* this will start another rexx program and pass arguments to it */ call 'g:\source\ERMVectorStripper.cmd' ' -p' 'I:\DLG\100K\FONT-E\BDY\FOLAB8' /* to call an external routine named "comma" */ call "comma" SomeNumber /* or */ rc="comma"(SomeNumber) /* in the external routine do this */ Number = ARG(1) ..... RETURN VALUE ------------------------------------------------------------------------ The contents of these pages are copyright © 1999, PillarSoft & Wayne Swanson. [Image]