More on macro input parameters and return code

Access to the parameter list
MACRO PAWEX08A PAW > exe pawex08a 23 9
i = 10 23 squared is 529
1 FOR p IN [*] [i] 1 2 9 squared is 81
sq = [p] * [p] 10 squared is 100
message [p] squared is [sq] 1 squared is 1
ENDFOR 2 squared is 4
Indexed positional parameters
MACRO PAWEX08B PAW > exe pawex08b 23 9 48
2 DO i = 1, [#] parameter 1 is 23
3 message parameter [i] is [%i] parameter 2 is 9
ENDDO parameter 3 is 48

- The * sign allows to access the list of input parameters.
- The # sign allows to access the number of input parameters.
- % allows to have indexed positional parameters.
EXITM return code
MACRO PAWEX08C PAW > exe pawex08c
MESSAGE At first, '[@]' = [@] At first, [@] = 0
EXEC EXIT2 Macro EXIT2: NUM ? 25
IF [@] = 0 THEN Number too large
MESSAGE Macro EXIT2 successful Error in EXIT2 : 5
ELSE PAW > exe pawex08c
MESSAGE Error in EXIT2 : [@] At first, [@] = 0
ENDIF Macro EXIT2: NUM ? 16
RETURN Macro EXIT2 successful
MACRO EXIT2
READ NUM
IF [NUM] > 20 THEN
MESSAGE Number too large
EXITM [NUM]-20
ELSE
VEC/CRE VV([NUM])
ENDIF
RETURN
Last update: 96/05/24 17.19 Olivier.Couet@Cern.Ch