Home > AS/400 Tips > iSeries programmer tips > Trap that disconnection error
iSeries 400 Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

ISERIES PROGRAMMER TIPS

Trap that disconnection error


John Kohan, Search400 expert
03.27.2002
Rating: -4.31- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   



John Kohan

One thing I've noticed over the years is often interactive programs don't trap for disconnection errors. When any type of maintenance is being done on a file, it's crucial to perform proper clean up. This issue can arise from a user simply terminating his telnet session. If SQL commitment control isn't being used, it can be time-consuming to verify files and potentially have to clean them up.

If you're developing a Radio Frequency (RF) application, the possibility of loosing connection with the device during the program cycle is greater than when you are dealing with a normal workstation. If the program you're writing has multiple communications with the user, it may be necessary to properly "cleanup" the process if its connection with the user is lost.

A simple solution is to add an indicator on the EXFMT in the LO column. Immediately after the EXFMT, check for that indicator to be *ON and execute a subroutine. That subroutine should be written to do any necessary clean up and shut down the program clean. And if necessary, send a message to the appropriate person, depending on the level of the program's importance.

Code:

C                     EXFMTCONTROL                88 
C     *IN88     CASEQ'1'                     $S900           

C****************************************************************
C** $S900 - Screen Error Cleanup                                 
C****************************************************************
C           $S900     BEGSR                                      
C*                                                              
C**Add any processing you wish here
C*                                                              
C                     CALL 'XXXXXXXX'               Physical Disconnect
C                     EXSR $S001                      Exit       
C**                                                              
C                     ENDSR                                      
C**                                  

-----------------------------------------
About the author: John Kohan is a senior programmer analyst at CT Codeworks.

==================================
MORE INFORMATION
==================================



iSeries Security - Security Tools, Physical Security and System Security
HomeNewsTopicsITKnowledge ExchangeTipsBlogsAsk the ExpertsMultimediaWhite PapersProducts
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2010, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts