Re: tracking execution
Posted in 1992
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL, Transactions, Locking & Isolation
> A company I have been working is having a problem with deadlocks. We > handled this by checking the status variable after executing any critical > transactions. If there is a deadlock status returned we call a routine > to handle this, which does a rollback. This works fine except we would > like to know what statement caused it and where in the code it is. > > So basically what we would like to know is if there any globals variables > or something to return the same information you get when there is an > actual error, ie. the module and line number. > > I know we could hardcode them into all the calls but there alot of them > and they would also have to be changed whenever we change code. > > We are currently running OnLine 4.0, I4GL 4.0 on Intergraph equipment. > > Our current call looks like the following : > > SOME CRITICAL DATABASE TRANSACTION > IF status < 0 THEN > CALL handle_warning(status) > END IF > > handle_warning then insert the status into a table and send E-mail to the > programming group that a deadlock happened and restarts the program for the > user. > > Any help on how to determine where the program is executing would be > appreciated. > > Bill Connors > I question the restart program functionality this is not all that easy to do possible but difficult. Easiest run in a OS shell loop. The error info can be acomplished much easier than you think. Really easy if you can live with not putting the info in a table. In your main add the following two lines. # open a errorlog file all 4gl errors written on occurence # # consisting of date time source-module name and the line number # # The error number and error message. Doc I4gl Ref Vol1 Sec 6 # # 4gl Function Library. # call startlog ( "your_errorlog_file" ) # write a string to error log file # call errorlog ( "Program accesed" ) # just as it says whenever error call this function # # NOTE it is documented that certain errors aborts program # # completly Tough Luck. Deadlocks are not one of them # whenever error call log_err And add your log_err function. Write a routine to read the error log file if you really need to insert the error info into a table. and do the email notification routine. function log_err() define u_pid_no e_str char(70), ss2 char(16) message "Error occured Check error_log file for details" attribute(red) sleep 5 message "" # gets user pid and user name # call get_pid() returning u_pid_no ,ss2 let e_str = "Error ocurred for User name ", ss2, " Process id = ", u_pid_no using "<<<<<<<<<<" # This writes to the error log file # call errorlog( e_str ) end function +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Mail Path: jerry@jerry.mendota.ingr.com Jerry Jugovich Phone: 612 681-4450 TIM Application Engineer Intergraph Corporation Mendota Heights Minnesota +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++