85 pts.
 CHAIN(E)
what is chain(e) please explane with example

Software/Hardware used:
ASKED: April 2, 2008  10:32 AM
UPDATED: May 20, 2011  10:44 AM

Answer Wiki:
From the WebSphere Development Studio ILE RPG Language Reference Version 5 manual: <b>To handle CHAIN exceptions (file status codes greater than 1000), either the operation code extender ’E’ or an error indicator ER can be specified, but not both. For more information on error handling, see “File Exception/Errors” on page 65.</b> An example: C RECORDKEY CHAIN(E) FILEREC *> If no record found, write a new one. Otherwise, update the *> existing One. C IF %STATUS ( FILENAME ) = 00012 No-record-found C WRITE FILEREC C ELSE C UPDATE FILEREC C ENDIF
Last Wiki Answer Submitted:  April 2, 2008  1:21 pm  by  Rlsantucijr   445 pts.
All Answer Wiki Contributors:  Rlsantucijr   445 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

The E extender tells the program that you are handling errors on the CHAIN. You can test for an error condition by using the %ERROR BIF and when it is true, test for specific situations using the %STATUS BIF if that is appropriate for your code. The %ERROR will only work when you specify the E extender on the operation.
One thing to be aware of is that if an error indicator is also specified, the program will consider the error handled by the indicator and the %ERROR BIF will not test true. The indicator comes before the E extender in the error handling hierarchy, and the MONITOR comes after the extender.

 45 pts.

 

Hi,

I’m not sure whether the previous answers were what you were looking for, maybe you just wanted to know what the chain operation does :-

Chain is an operation code to retrieve a single data record from a file. The record can be retrieved by relative record number or a key (if the file has a key defined). After a chain operation the record can be updated with new data or the record can be deleted from the file.

Regards,

Martin Gilbert.

 23,625 pts.