Run-Time Subroutine: Returns the specified command-line argument (where the command itself is argument number 0).
Module: USE DFLIB
Syntax
GETARG can be used with two or three arguments. If you use module DFLIB.F90 in the \DF98\INCLUDE subdirectory (by including the statement USE DFLIB), you can mix calls to GETARG with two or three arguments. If you do not use DFLIB.F90, you can use either two-argument or three-argument calls to GETARG but only one type of call within a subprogram.
GETARG returns command-line arguments as they were entered. There is no case conversion.
If the command-line argument is shorter than buffer, GETARG pads buffer on the right with blanks. If the argument is longer than buffer, GETARG truncates the argument. If there is an error, GETARG fills buffer with blanks.
Assume a command-line invocation of ANOVA -g -c -a, and that buffer is at least five characters long. The following GETARG statements return the corresponding arguments in buffer:
Statement | String returned
in buffer |
Length returned
in status |
---|---|---|
CALL GETARG (0, buffer, status)
|
ANOVA
|
5
|
CALL GETARG (1, buffer)
|
-g
|
undefined
|
CALL GETARG (2, buffer, status)
|
-c
|
2
|
CALL GETARG (3, buffer)
|
-a
|
undefined
|
CALL GETARG (4, buffer, status)
|
all blanks
|
-1
|
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
Example
USE DFLIB
INTEGER(2) result
result = RUNQQ('prog', '-c -r')
END
! PROG.F90
USE DFLIB
INTEGER(2) n1, n2, status
CHARACTER(80) buf
n1 = 1
n2 = 2
CALL GETARG(n1, buf, status)
WRITE(*,*) buf
CALL GETARG(n2, buf )
WRITE (*,*) buf
END