Slide 75 of 80
Notes:
- A parameter and variable can have the same name but this should be avoided to improve support of UDC and scripts
- PARM p1=abcsetvar p1, “xyzzy”echo P1=!p1 ---> P1=abcecho P1=![p1] ---> P1=xyzzy
Note: explicit referencing (!x) looks for parameters first, then if no match searches for variables. Implicit referencing (x) does not look for parameters at all, and only searches for a variable name.
- PARM p1, p2=abc, p3=“def”, p4=1, p5=“1”, p6=true,p7=“false”, p8=!p2, p9=![rht(HPJOBNAME,-2)]
- Argument P1 is required. Argument P8 contains the value of P2. Argument P9 defaults to the value of the HPJOBNAME variable -- less the first character.
- Internal to the CI all parameter values are stored as strings, but since parameters must be explicitly referenced (!parmname) their string type is not preserved. Thus, to a CI programmer all parameter values are un-typed:
- calc typeof(p2) = 0 # no meaning since parm p2 was not explicitly referenced (assume no variable named P2)
- calc typeof(!p2) = 0 # no meaning (assume no variable named ABC)
- calc typeof(“!p2”) = 2 # string, regardless of p2’s value since value was quoted
- calc typeof(!p4) = 1 # integer
- calc typeof(!p5) = 1 # integer, quotes around default value don’t matter
- calc typeof(!p6) = 3 # boolean
- calc typeof(“!p6”) = 2 # string since I quoted it!
- calc typeof(!p7) = 3 # boolean