Monday, July 13, 2009

(Q&A) Why do we hit a session device error?

(From : Anonymous)

There are three types of AS/400 session device error:

1. Permanent device or session error on I/O operation

A major return code of 81 indicates a serious error that affects the device or session.

These errors include hardware failures that affect the device, communications line, or communications controller. It also includes errors because of a device being disconnected or powered off unexpectedly, and abnormal conditions that are discovered by the device and reported back to the system. Both the minor return code and the accompanying message provide more specific information about the cause of the problem.

Depending on the file type, the program must either close the file and open it again, release the device and acquire it again, or acquire the session again. To reset an error condition in a shared file by closing it and opening it again, all programs sharing the open data path must close the file. In some cases, the message might instruct you to reset the device by varying it off and on again. It is unlikely that the program will be able to use the failing device until the problem causing the error is found and corrected, but recovery within the program might be possible if an alternate device is available.

Some of the minor return codes in this group are the same as those for the 82 major return code. Device failures or line failures might occur at any time, but an 81 major code occurs on an I/O operation. This means that your program had already established a link with the device or session. Therefore, the program can transfer some data, but when the program starts from the beginning when it starts again. A possible duplication of data might result.

Message numbers accompanying an 81 major code might be in the range that indicates either an I/O or a close operation. A device failure on a close operation might be the result of a failure in sending the final block of data, rather than action specific to closing the file. An error on a close operation can cause a file to not close completely. Your error recovery program should respond to close failures with a second close operation. The second close will always complete, regardless of errors.

2. Device or session error on open or acquire operation

A major return code of 82 indicates that a device error or a session error occurred during an open or acquire operation. Both the minor return code and the accompanying message will provide more specific information regarding the cause of the problem.

Some of the minor return codes in this group are the same as those for the 81 major return code. Device or line failures might occur at any time, but an 82 major code indicates that the device or session was unusable when your program first attempted to use it. Thus no data was transferred. The problem might be the result of a configuration or installation error.

Depending on the minor return code, it might be appropriate for your program to recover from the error and try the failing operation again after some waiting period. You should specify the number of times you try in your program. It might also be possible to use an alternate or backup device or session instead.

Message numbers accompanying an 82 major code might be in the range that indicates either an open or acquire operation. If the operation is an open operation, it is necessary to close the partially opened file and reopen it to recover from the error. If the operation is an acquire operation, it might be necessary to do a release operation before trying the acquire operation again. In either case, specify a wait time for the file that is long enough so that the system can recover from the error.

3. Recoverable device or session errors on I/O operation

A major return code of 83 indicates that an error occurred in sending data to a device or receiving data from the device. Recovery by the application program is possible. Both the minor return code and the accompanying message provide more specific information regarding the cause of the problem.

Most of the errors in this group are the result of sending commands or data that are not valid to the device, or sending valid data at the wrong time or to a device that is not able to handle it. The application program can recover by skipping the failing operation or data item and going on to the next one, or by substituting an appropriate default. There might be a logic error in the application.

The most common one is type 2, wherein you are trying to write an empty subfile. To find out the details of the encountered error, check the session's joblog by using DSPJOBLOG command then press ENTER, F10, PAGEUP, point your cursor to the error then hit F1.

No comments:

Post a Comment