The ACQUIRE statement acquires a program device for a TRANSACTION file.
ACQUIRE Statement - Format - TRANSACTION >>-ACQUIRE--+-identifier-+--FOR--file-name--------------------->< '-literal----'
For a description of conditions that must be met before a communication device can be acquired, see the ICF Programming manual. For a description of conditions that must be met before a display station can be acquired, refer to the DB2® for i section of the Database and File Systems category in the IBM® i Information Center at this Web site - http://www.ibm.com/systems/i/infocenter/.
Successful completion of the ACQUIRE operation makes the program device available for input and output operations. If the ACQUIRE is unsuccessful, the file status value is set to 9H and any applicable USE AFTER EXCEPTION/ERROR procedure is invoked.
Only one program device may be implicitly acquired when a file is opened. If a file is an ICF file, the single implicitly acquired program device is determined by the ACQPGMDEV parameter of the CRTICFF CL command. If the file is a display file, the single implicitly acquired program device is determined by the first entry in the DEV parameter of the CRTDSPF CL command. Additional program devices must be explicitly acquired.
A program device is explicitly acquired by using the ACQUIRE statement. For an ICF file, the program device must have been defined to the file with the ADDICFDEVE or OVRICFDEVE command before the file is opened. For a display file, if the program device name is not the name of the display device, then the device must have been specified in the DEV parameter when the file was created, changed, or overridden, and before the OPEN is issued for the file.
For more information on these CL commands for display stations, see the CL and APIs section of the Programming category in the IBM i Information Center at this Web site - http://www.ibm.com/systems/i/infocenter/. See the ICF Programming manual for information on these CL commands for communication devices. The ACQUIRE statement can also be used as an aid in recovering from I-O errors. For more information on recovery procedures, see the section on "Communications Recovery" in the IBM Rational Development Studio for i: ILE COBOL Programmer's Guide.