Date:         Tue, 30 May 1995 09:32:56 +0000
Reply-To:     The NOMAD2 Discussion List
Sender:       The NOMAD2 Discussion List
From:         Stace Cameron
Subject:      Re: Shared/Local DB

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.

------------------------------ cut here ----------------------
/* procedure TSTDB */

trans;
/**********************/
/*  start out shared  */
/**********************/
declare &elapsed as time;

/**********************/
/*  drop database     */
/**********************/
dbclear otw;
sl pgmtrk otw print 'sl pgmtrk fails';


/***********************/
/*  get local access   */
/***********************/
SYS REL 194 (DET otw;
sys CP LINK K38001 191 194 RR readpass;
sys acc 194 B;

   da pgmtrk;
   sl pgmtrk otw print 'sl pgmtrk fails';
   &start1=&datetime;
   list pgmtrk nopr;
   &end1=&datetime;
   &elapsed=&end1-&start1;
   print 'local ' &elapsed;

/**********************/
/*  drop database     */
/**********************/
SYS REL 194 (DET;
dbclear pgmtrk;
sl pgmtrk otw print 'sl pgmtrk fails';


/***********************************/
/*  reaccess as shared              */
/**********************************/
   da pgmtrk ownerid k38001;
   sl pgmtrk otw print 'sl pgmtrk fails';
   &start1=&datetime;
   list pgmtrk nopr;
   &end1=&datetime;
   &elapsed=&end1-&start1;
   print 'shared ' &elapsed;
untrans;
------------------------------ cut here ----------------------

/* TSTCALL - calls TSTDB procedure */
trans;

da pgmtrk ownerid k38001;
sl pgmtrk otw print 'sl pgmtrk fails';
print 'before call tstdb';

call tstdb;

print 'after call';
first pgmtrk;
ampset pgmtrk;
sl pgmtrk otw print 'sl pgmtrk fails';
untrans;
------------------------------ cut here ----------------------

BTW, the above example reports an elapsed time of approximately
10 time faster for the non-shared report!

Stace Cameron
Southern Illinois University - School of Medicine
scameron@siumed.edu
back to index