getCmdLineArg()
The sysLib.getCmdLineArg() system function returns a specified argument from the list of arguments that were used to call the EGL program. The specified argument is returned as a STRING value.
Use sysLib.getCmdLineArgCount() to return the number of arguments available.
Syntax
sysLib.getCmdLineArg(index INT in)
returns (result STRING)
- index
- The index can be any integer variable.
- If index = 0, the function returns the name of the first program in the run unit.
- If index = n, the function returns the nth argument.
- If n is greater than the argument count or less than 0, the function returns a blank.
- result
- You can assign the result to any variable that is assignment compatible with the STRING type (see "Assignment compatibility in EGL").
Example
The following code example loops through the argument list and
stores the arguments in an array:
count INT;
argumentCount INT;
argument[] CHAR(20);
count = 1;
argumentCount = sysLib.getCmdLineArgCount();
while (count < argumentCount)
argument[count] = sysLib.getCmdLineArg(count)
count = count + 1;
end
Compatibility
| Platform | Issue |
|---|---|
| COBOL generation | The sysLib.getCmdLineArg() function is not supported. |
| JavaScript™ generation | The sysLib.getCmdLineArg() function is not supported. |