[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: behaviour of save qualifier to on-break
- Subject: Re: behaviour of save qualifier to on-break
- From: Ray Ontko <rayo@ONTKO.COM>
- Date: Sun, 9 Nov 1997 16:13:57 -0500
- In-Reply-To: <H000095106e56cb1@MHS> from Mainoo Smith at "Nov 6, 97 04:54:41 pm"
Mainoo,
> i am confused by the workings of 'on-break' and its 'save' qualifier.
> is it the case that the variable supplied to save is initialised with
> the first occurrence of the break field even BEFORE an on-break occurs?
>
> from what i can see the first occurrence of a field that has on-break set
> does not trigger the on-break command yet the save variable is set
> during the processing of the first occurrence. the on-break command is
> triggered for the first time on transition from the first to the second
> occurrence.
Here's my understanding of how it works. When the begin-select
starts, all save= variables are cleared. Then the before=
procedure is executed, then the new values are saved into the save=
variables, then when the value changes the new value appears in
the "&" variable and the after= procedure is fired, then the
before procedure is fired, etc.
A simple test program demonstrates the behavior. My two tables
are named T and U, and the output and program listing are shown
below.
Ray
-----
pre junk,
before ,T
during T,T
after T,U
before U,U
during U,U
after U,U
post U,U
-----
begin-program
do main
end-program
begin-procedure main
move 'junk' to $old_table_name
show 'pre ' $old_table_name ',' &table_name
begin-select
table_name &table_name () on-break print=never save=$old_table_name
before=b after=a
show 'during ' $old_table_name ',' &table_name
from user_tables
end-select
show 'post ' $old_table_name ',' &table_name
end-procedure ! main
begin-procedure a
show 'after ' $old_table_name ',' &table_name
end-procedure
begin-procedure b
show 'before ' $old_table_name ',' &table_name
end-procedure
----------------------------------------------------------------------
Ray Ontko | Ray Ontko & Co | "Time for a new signature line."
rayo@ontko.com | Richmond, In | See us at http://www.ontko.com/