Date: Wed, 31 May 1995 07:57:10 -0400 Reply-To: The NOMAD2 Discussion List Sender: The NOMAD2 Discussion List From: "Darrell R. Pitzer" Subject: Update in Shared, Report in Private, no TRANS RE: Message from Stace Cameron >> Bill, I am looking for code samples, preferably where one does not >> have to place the entire application in trans/untrans. For example, the >> following code does what I want it to do when run interactively, but >> when I call it from another procedure, I get: >> >> EXC0176: A TRANS mode DBCLEAR has nullified the following statement: >> EXC0301: Return Code 1000, executing statement 11.01, in TSTCALL. >> >> Placing the entire calling procedure (TSTCALL) in trans/untrans >> solves the error but at the expense of running the entire calling >> procedure in trans mode. We typically implement our applications >> with update procedures and a reporting menu. The report procedures >> may either be run inteactively or in batch mode. We have no problems >> running the batch mode reports from a readonly link to the database, >> I would like to improve the performance of the online reporting. Unfortunately, there is no way to do this without TRANS mode or without leaving NOMAD (which implicitly does a DBCLEAR). Since you are concerned about TRANS mode, let me suggest a method that has you exit/re-enter NOMAD to switch between shared and private access to the database. It's a kludgy method, but one that works. Have your update procedure access in shared mode, your reporting procedure access in private mode, and let your calling EXEC switch back and forth between the two. You'd have some overhead leaving and re-entering NOMAD, but that would probably be better than running the reports in shared mode and maybe even better than running the reports in private mode via TRANS/UNTRANS. You'd have to test to be sure. Here's one way to do this: In your update procedure: da PGMTRK ownerid K38001; /*... update code ...*/ /*... code that detects the user wants to do reports ...*/ &&SysRC = 1; exit; In your report procedure: da PGMTRK; /*... reporting code ...*/ /*... code that detects the user wants to exit reports and ..*/ /*... return to the update procedure ..*/ &&SysRC = 2; exit; In your EXEC that calls the procedure(s) (REXX assumed): /* Default is to go to update procedure */ Program = 'UPDATE' /* Substitute actual name of NOMAD proc. */ /* Loop while switching back and forth */ do forever 'NOMAD2' Program /* Or whatever method used to invoke NOMAD */ nRC = RC select when nRC = 1 then do Program = 'REPORT' /* Substitute name of report proc. */ /* Get a read link to shared database 191 disk */ 'RELEASE 194 (DET' 'CP LINK K38001 191 194 RR readpass' 'ACCESS 194 B' iterate end when nRC = 2 then do Program = 'UPDATE' /* Substitute name of update proc. */ /* Be sure to drop read link to shared database 191 */ 'RELEASE 194 (DET' iterate end when nRC = 0 then exit /* RC=0 implies all was OK */ otherwise say say 'Oops! Return code "'nRC'" from "'Program'"!' exit end end If you were wary of using the system return code, you could use the NOMAD STACK command to stack a message. The calling EXEC could check (via REXX QUEUED() function). Here's the same example using the stack: In your update procedure: da PGMTRK ownerid K38001; /*... update code ...*/ /*... code that detects the user wants to do reports ...*/ stack 'REPORT'; exit; In your report procedure: da PGMTRK; /*... reporting code ...*/ /*... code that detects the user wants to exit reports and ..*/ /*... return to the update procedure ..*/ stack 'UPDATE'; exit; In your EXEC that calls the procedure(s) (REXX assumed): /* Default is to go to update procedure */ Program = 'UPDATE' /* Substitute actual name of NOMAD proc. */ /* Loop while switching back and forth */ do forever 'NOMAD2' Program /* Or whatever method used to invoke NOMAD */ if QUEUED() > 0 then do pull Message . select when Message = 'REPORT' then do Program = 'REPORT' /* Substitute name of report proc. */ /* Get a read link to shared database 191 disk */ 'RELEASE 194 (DET' 'CP LINK K38001 191 194 RR readpass' 'ACCESS 194 B' iterate end when Message = 'UPDATE' then do Program = 'UPDATE' /* Substitute name of update proc. */ /* Be sure to drop read link to shared database 191 */ 'RELEASE 194 (DET' iterate end otherwise say say 'Oops! Unknown message "'Message'" from "'Program'"!' exit end end else leave /* No message stacked implies end of application */ end Be sure to have your shared database server with &&ServerTimeOut set high enough. If only one person is using the application, leaving the shared mode update procedure to go to the private mode report procedure will let the shared database userid log off unless &&ServerTimeOut is set. This will avoid the overhead of having NOMSRVR log on the shared database userid again and again. Hope this helps, Darrell Pitzer, Exxon R&D, (504) 359-1130, Darrell.R.Pitzer@Exxon.Sprint.COM back to index