Caché MultiValue Basic Reference
GET(ARG.)
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Retrieves the next command line argument.
Synopsis
GET(ARG.[,n]) variable [THEN statements] [ELSE statements]
Arguments
n Optional — An integer specifying which command line argument to retrieve. The default is the first unread argument (the next argument).
variable A local variable used to hold the value of the command line argument retrieved.
Description
The GET(ARG.) statement retrieves a command line argument, copying its value into variable. Each time you invoke GET(ARG.) it updates a command line pointer. Therefore, repeated invocation of GET(ARG.) without the n argument results in the sequential retrieval of each command line argument in left-to-right order.
The keyword ARG. (note the period at end of this keyword) and the surrounding parentheses are mandatory.
You can use the optional n value to retrieve a command line argument by its integer position in the command line argument list. Command line arguments are counted from 1. If n=0, GET(ARG.) retrieves the next command line argument.
GET(ARG.) considers all values following the program name to be command line arguments. Command line arguments are separated by blank spaces; a blank space within a quoted string is not treated as a command line argument separator.
You can optionally specify a THEN clause, an ELSE clause, or both a THEN and an ELSE clause. If the command line argument retrieval is successful, the THEN clause is executed. If there are no command line arguments, no more command line arguments, or if you specify a value of n that does not correspond to a command line argument, or a negative value for n, GET(ARG.) executes the ELSE clause. If no ELSE clause in provided, GET(ARG.) returns the empty string to variable. The statements argument can be the NULL keyword, a single statement, or a block of statements terminated by the END keyword. A block of statements has specific line break requirements: each statement must be on its own line and cannot follow a THEN, ELSE, or END keyword on that line.
The GET(ARG.) statement both moves the command line argument pointer and retrieves the argument value. The SEEK(ARG.) statement just moves the command line argument pointer. The EOF(ARG.) function returns whether or not the command line argument pointer is past the end of the list of command line arguments.
See Also