How the server allocates resources

When it allocates resources, the server waits for a predefined time if the resources are not immediately available. If the resources do not become available within the time limit, the server generates an error.

If you are using the ALCOBJ command, the command fails. If your program is performing a file operation, that operation fails, and the server sends an error message to the program message queue. You can use the error-handling functions of your high-level language to try the operation again. For example, if an open operation fails because another job is using the device associated with the file, you can try the open operation a specified number of times again, in the hope that the other job would finish with the device and your program would then be able to use it.

The length of time that the server waits when allocating resources is specified on the ALCOBJ command and on the WAITFILE parameter of the CL command used to create the file. If the ALCOBJ command is used before running a program, then the value of the WAITFILE parameter does not matter, because the resources will be available.

If your application has error handling procedures for handling device errors occurring on device files, you should specify a value of something other than *IMMED to allow the server to recover from the error. The allocation of resources requested by your program on an open or acquire operation that allows your program to recover from the error will not be successful until the server recovery procedures have been completed for the device.

The following list describes the values that are allowed for the WAITFILE parameter:

*IMMED
This value specifies that no wait time is allowed. An immediate allocation of the file resources is required.
*CLS
The job default wait time is used as the wait time for the file resources to be allocated.
number-of-seconds
Specify the maximum number of seconds that the program is to wait for the file resources to be allocated. Valid values are 1 through 32767 (32 767 seconds).