+-------------------------------IBM Extension--------------------------------+
The ACCEPT statement retrieves information from the data area specified in the FOR phrase.
ACCEPT Statement - Format 9 - Data Area
>>-ACCEPT--identifier-1--FROM--mnemonic-name-------------------->
>--FOR--+-identifier-2-+---------------------------------------->
'-literal-1----'
>--+-----------------------------------+------------------------>
'-+----+--LIBRARY--+-identifier-3-+-'
'-IN-' '-literal-2----'
>--+----------------------+--+-----------+---------------------->
'-AT--+-identifier-4-+-' '-WITH LOCK-'
'-integer-1----'
>--+-------------------------------------------+---------------->
'-+----+--EXCEPTION--imperative-statement-1-'
'-ON-'
>--+------------------------------------------------+----------->
'-NOT--+----+--EXCEPTION--imperative-statement-2-'
'-ON-'
>--+------------+----------------------------------------------><
'-END-ACCEPT-'
Identifier-1 can be class alphanumeric, numeric, DBCS, or national.
If the description of identifier-1 contains a TYPE clause, the type-name referenced in that clause must be elementary.
The FROM phrase specifies a mnemonic-name that must be associated with an environment name of DATA-AREA in the SPECIAL NAMES paragraph.
Identifies the operating system data area to retrieve information from. If the specified data area cannot be found at runtime, an ON EXCEPTION error occurs.
Is used to specify the name of the operating system library in which the data area is to be found. The special values *LIBL (search using the job's library list) or *CURLIB (search the current library) may be specified. If the LIBRARY phrase is omitted, the job's library list is used to search for the data area.
Identifier-2, identifier-3, literal-1, and literal-2 are not affected by the *MONOPRC compiler option. They can contain an operating system quoted name (for details, see "Rules for Specifying Names" in the CL and APIs section of the Programming category in the iSeries Information Center at this Web site -http://www.ibm.com/eserver/iseries/infocenter).
The AT phrase indicates the starting position in the data area from which text is received.
If the AT phrase is not specified, a starting position of 1 is assumed.
While the ACCEPT statement is retrieving information into identifier-1, the data area is locked with an LSRD (Lock Shared for Read) lock to prevent the data area from being changed. After identifier-1 is accepted, the WITH LOCK phrase places a LEAR (Lock Exclusive Allow Read) lock on the data area. If a lock cannot be placed on the data area, an exception condition occurs.
To maintain a lock on the data area after the transfer of data, specify this phrase. If a lock existed on the data area prior to this statement and the statement did not contain a WITH LOCK phrase, the lock is released.
If an error occurs while accessing the data-area, then any imperative statement specified in the ON EXCEPTION phrase is processed. In the absence of the ON EXCEPTION phrase, a run-time message is issued. If the data area is accessed successfully, any imperative statement specified in the NOT ON EXCEPTION phrase is processed.
The END-ACCEPT explicit scope terminator serves to delimit the scope of the ACCEPT statement. END-ACCEPT permits a conditional ACCEPT statement to be nested in another conditional statement. END-ACCEPT may also be used with an imperative ACCEPT statement. For more information, see the section on Delimited Scope Statements.
+----------------------------End of IBM Extension----------------------------+
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.