QTIPS - Replacing GAS.BAR routine during PERFORM "SELECT"
Published By | Date | Version | Knowledge Level | Keywords |
---|---|---|---|---|
Sprezzatura Ltd | 01 JAN 1992 | 2.11+ | EXPERT | GAS.BAR, PERFORM, SELECT, @RN.COUNTER, @REC.COUNT, DISPLAY_PROGRESS, @SENTENCE |
Mike Pope of Revelation Technologies (UK) Ltd in conjunction with David Kralman of the Seattle RUG has contributed one of those earth-shattering tips that have you kicking yourself asking why you never saw it. For those who have not seen this tip before :-
In one of our applications we have disabled the status line completely and use our own routine to provide bottom screen line help. This works perfectly when called as a preprompt from Window, or from within our menu driver, however it does not cater for the "Gas Bar" display used when performing a select. Previously it had been necessary to display a "Please Wait" message and then just perform the select. A routine had already been developed (DISPLAY_PROGRESS) which working off a record count in labelled common and @RN.Counter, graphically plotted the progress of a Readnext loop on screen. DISPLAY_PROGRESS has three call types, @RN.Counter = 0, initialise; @RN.Counter = Record Count, tidy up screen; Otherwise, update display. What was needed was a way to call the initialise and the update from within the PERFORM "SELECT" - the tidy up would be done automatically when @RN.Counter reached @Rec.Count.
The solution was elegant simplicity. Simply create a symbolic on the dict of Voc called GAS_BAR which has code similar to the following pseudo code
If @SENTENCE # "Done" Then Get Reccount for file Initialise @RN.Counter to 0 Call custom gas bar passing rec.count Set @SENTENCE to "Done" End Else Call custom gas bar End @ANS = 1
and then PERFORM "SELECT FILE BY FIELD WITH GAS_BAR AND WITH REST_OF_CRITERIA". The position of WITH GAS_BAR is irrelevant as it still gets processed regardless of whether other WITHs fail. (Worth bearing in mind if you are selecting on two complex symbolics, it might be worth selecting with one, and then selecting on the resolved list with the other so as not to evaluate both symbolics for all records).
(Volume 3, Issue 8, Page 10)