home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / database / informix / 2415 < prev    next >
Encoding:
Internet Message Format  |  1992-11-14  |  3.9 KB

  1. Path: sparky!uunet!ukma!wupost!emory!emory!not-for-mail
  2. From: jerry@jerry.mendota.ingr.com (Jerry Jugovich)
  3. Newsgroups: comp.databases.informix
  4. Subject: Re: tracking execution
  5. Date: 13 Nov 1992 11:28:04 -0500
  6. Organization: Mailing List Gateway
  7. Lines: 92
  8. Sender: walt@mathcs.emory.edu
  9. Distribution: world
  10. Message-ID: <1e0l2kINNsgg@emory.mathcs.emory.edu>
  11. Reply-To: jerry@jerry.mendota.ingr.com (Jerry Jugovich)
  12. NNTP-Posting-Host: emory.mathcs.emory.edu
  13. X-Informix-List-ID: <list.1602>
  14.  
  15. > A company I have been working is having a problem with deadlocks.  We 
  16. > handled this by checking the status variable after executing any critical
  17. > transactions.  If there is a deadlock status returned we call a routine
  18. > to handle this, which does a rollback.  This works fine except we would
  19. > like to know what statement caused it and where in the code it is.
  20. > So basically what we would like to know is if there any globals variables
  21. > or something to return the same information you get when there is an 
  22. > actual error, ie. the module and line number.
  23. > I know we could hardcode them into all the calls but there alot of them
  24. > and they would also have to be changed whenever we change code.
  25. > We are currently running OnLine 4.0, I4GL 4.0 on Intergraph equipment.
  26. > Our current call looks like the following :
  27. >      SOME CRITICAL DATABASE TRANSACTION
  28. >      IF status < 0 THEN
  29. >          CALL handle_warning(status)
  30. >      END IF
  31. > handle_warning then insert the status into a table and send E-mail to the
  32. > programming group that a deadlock happened and restarts the program for the 
  33. > user.
  34. > Any help on how to determine where the program is executing would be 
  35. > appreciated.
  36. >                         Bill Connors
  37.  
  38. I question the restart program functionality this is not all that easy to do
  39. possible but difficult.  Easiest run in a OS shell loop.
  40.  
  41. The error info can be acomplished much easier than you think. Really easy if
  42. you can live with not putting the info in a table.
  43.  
  44. In your main add the following two lines. 
  45.  
  46.              # open a errorlog file  all 4gl errors written on occurence      #
  47.              # consisting of date time source-module name and the line number #
  48.              # The error number and error message. Doc I4gl Ref Vol1 Sec 6    #
  49.              # 4gl Function Library.                                          #
  50.  
  51.              call startlog ( "your_errorlog_file" )
  52.  
  53.              # write a string to error log file # 
  54.              call errorlog ( "Program accesed" )
  55.  
  56.              # just as it says whenever error call this function         # 
  57.              # NOTE it is documented that certain errors aborts program  #
  58.              # completly Tough Luck. Deadlocks are not one of them       #
  59.  
  60.              whenever error call log_err
  61.  
  62.  
  63. And add your log_err function.
  64.  
  65. Write a routine to read the error log file if you really need to insert the
  66. error info into a table. and do the email notification routine.
  67.  
  68. function log_err()
  69.  
  70.     define 
  71.     u_pid_no
  72.     e_str char(70),
  73.     ss2 char(16)
  74.  
  75.         message "Error occured Check error_log file for details" attribute(red)
  76.         sleep 5
  77.         message ""
  78.  
  79.         # gets user pid and user name #
  80.         call get_pid() returning u_pid_no ,ss2   
  81.  
  82.         let e_str = "Error ocurred for User name ",
  83.                      ss2,
  84.                      " Process id = ",
  85.                      u_pid_no using "<<<<<<<<<<"
  86.  
  87.         # This writes to the error log file #
  88.         call errorlog( e_str )        
  89.  
  90. end function
  91.  
  92. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  93.  Mail Path: jerry@jerry.mendota.ingr.com        Jerry Jugovich
  94.  Phone:     612 681-4450                        TIM Application Engineer
  95.                                                 Intergraph Corporation
  96.                                                 Mendota Heights Minnesota
  97. +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  98.