In UniData there are two built-in variables, synonyms actually, named @SENTENCE and @COMMAND. These contain the raw command line used to invoke your subroutine.
I usually TRIM this (to eliminate multiple blanks) and then convert blanks to a U2 dynamic array delimiter. I can then count and extract these arguments, sort of like argv and argc in C. A snippet ...
SUBROUTINE TEST.ARGS CMD.LINE = TRIM(@COMMAND) CONVERT ' ' TO @AM IN CMD.LINE NUM.CMD = DCOUNT(CMD.LINE, @AM) SUB.NAME = CMD.LINE<1> ARG1 = CMD.LINE<2> ARG2 = CMD.LINE<3>
I believe UniVerse has @SENTENCE also; not sure about @COMMAND.
Regards, Cliff
Chauhan, Savita wrote:
Hi,
I am trying to run a unibasic program (external subroutine) that takes two arguments. I don't know how do I pass it the arguments if I run it directly from shel prompt instead of calling it from another program. I have gone through the manual, but can't find anything. Pls help.
Thanks Savita. ------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/
------- u2-users mailing list u2-users@listserver.u2ug.org To unsubscribe please visit http://listserver.u2ug.org/