call - UDM Command
Syntax
call script-file [parameter-name=parameter-value]...
Description
The call command loads and executes a command script.
Scripts are interpreted line by line, with parameter substitution made just before each line is executed. Parameter substitution is indicated with a $(PARAMETER_NAME) sequence in the called script. Parameters are replaced by the value corresponding with the parameter's name (name=value format) in the call command itself. Each parameter of the call command must have a corresponding value.
call commands can be nested in called scripts up to ten levels deep.
If a parameter with the same name appears more than once in call, the first instance of the parameter with that name is used. If a parameter is referenced in the script, but was not passed in via the call command, an error is issued when the line with the reference is parsed.
Parameters
Parameter | Description |
---|---|
script-file | Filename of the script to process. |
parameter-name | Name of a parameter to pass to the script. |
parameter-value | Value to be set for the parameter. |
Examples
To invoke a script called script.udm.
- Parameter file has a value of *.
- Parameter src has a value of c:\source.
- Parameter dst has the value /etc/dest.
call script.udm file=* src=c:\source dst=/etc/dest
To invoke a script under IBM i, the member name is required and can be *FILE:
call mylib/myfile(myscript)
Specifying *FILE invokes the normal default IBM i file search order.
To invoke a script under IBM i included as an inline file in a database job, the call must specify *FIRST as the database member name.
The following example illustrates both:
- Invocation of an inline script, CALLME, using the STRUDM command from a database job.
- Invocation of an inline script, CALL1, using the CALL command from a database job.
//BCHJOB JOB(testcall) ENDSEV(10) OUTQ(mytest/UDMOUTQ) LOGCLPGM(*YES) LOG(2 20 *SECLVL) MSGQ(*USRPRF) //DATA FILE(CALL1) ENDCHAR(ENDDATAFILE) print msg="I made it to call1 - an inline file" ENDDATAFILE //DATA FILE(CALLME) ENDCHAR(ENDDATAFILE) OPEN S=AS400V5 USER=qatest PWD=***** PORT=4311 CALL CALL1(*FIRST) CLOSE ENDDATAFILE STRUDM SCRFILE(CALLME) //ENDBCHJOB