next up previous index
Next: Z265 Immediate Interface Up: CERNLIB Previous: Z262 Provide the

Z264 Returns Command Line Arguments

Routine ID: Z264
Author(s): F. Carminati, M. MarquinaLibrary: KERNLIB or Fortran Run-Time Library
Submitter: Submitted: 13.07.1988
Language: Fortran + CRevised: 15.03.1993

IARGC is used to return arguments that the user has given to an executable module on the command line.

Structure:

FUNCTION subprograms
User Entry Names: GETARG, IARGC

Usage:

    NPAR = IARGC()
sets NPAR to the number of blank delimited arguments present after the program name on the command line. NPAR and IARGC are of type INTEGER.
    CALL GETARG(IARG,GOTEXT)
IARG
( INTEGER) Contains, on entry, the number of the argument to retrieve. Unchanged on exit.
GOTEXT
( CHARACTER) Contains, on exit, the IARG-th argument.

Notes:

  1. Arguments surrounded by double quotes ( ") are treated as single, e.g.
        "a variable here"
    
    is equivalent to one argument.
  2. On VM/CMS, due to technical restrictions, at least one of the routines must be called before any I/O (typically a PRINT statement).
  3. GETARG(0,GOTEXT) returns name of executing program (not VM).

Example:

    CHARACTER*100 STRING
C
C-- Retrieve the number of arguments given to this program
C
    NPAR=IARGC()
C-- and then get one by one, storing it in STRING
    DO 10 N = 1,NPAR
    CALL GETARG(N,STRING)
    PRINT *, STRING(1:LENOCC(STRING))
 10 CONTINUE
    END

Z265


Janne Saarela
Mon Apr 3 15:06:23 METDST 1995