ASNA Mobile RPG® Reference Manual |
Naming an IBM i Job
In Mobile RPG users can designate the names of IBM
i jobs using the TerminalDeviceName
property.
Implementation
The property is applied in the MobileRPGJob class:
myDatabase = new AVRRuntime.Database("", AVRRuntime.VirtualTerminal.MonarchWeb, AVRRuntime.OpenAccessDspF.MobileRPG);
myDatabase.TerminalDeviceName = "MYDEV??";
The TerminalDeviceName property takes any string the developer inputs, and as a special option the string can include up to three question marks (?) after the string (i.e. MYDEV??). When a sequence of 1question marks are used in the trailing position of the device name, a 10 character name is generated substituting the '?' sequence with a (sequential) hexadecimal number (e.g. MYDEV00010).
The string length must be 8 or fewer characters, including any question marks. If a job using the specified name already exists, Mobile RPG will loop, and attempt to create a job one hex-digit higher until it lands on a job name that does not exist. If the name specified in the database connection is not available (or exceeds 8 characters), DataGate will throw an exception with one of the following values:
Name | Value |
---|---|
dgEx | {"DeviceName Not Available"} |
base | {"DeviceName Not Available"} |
DefaultErrorClass | dgEC_Base |
Error | dgEDEVICENAME |
ErrorClass | dgEC_Base |
Message | "DeviceName Not Available" |
ErrorClass | dgEC_Base |
Message | "DeviceName Not Available" |
SystemError |
0 |
Text |
"" |
The same exception will be thrown if the device name specified contains a suffix of question marks and no device available satisfies the name (all 'numbers' have been exhausted).
Important – While this can potentially support a very high number of job names, the number of iterations it demands makes this a very inefficient choice for supporting more than 20-30 simultaneous jobs with one application.
If the application is going to be naming Jobs, it is highly recommended that the system value QDEVRCYACN
be set to either *ENDJOB
or *ENDJOBNOLIST
. Please see IBM's documentation at
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/rzakz/rzakzqdevrcyacn.htm
To support larger numbers of similarly named jobs
without excessive wait times, Mobile RPG is compatible with
Telnet exit-point programs that can dynamically fulfill
that need without resorting to repeated
calls to the IBM i.