Hello,
I was just wondering if anyone else had run into this and knew *why* Unidata
version 6.1 was doing it...
I was requested to add a cumulative total to a Uniquery report. So after
editing a subroutine to do so, and running it I found some odd quirk. If I
make one pass with a sort and breaks, Unidata calls the subroutine during
the sort of the data, and does not call it during the display.
If I do a select first on the non-subroutine data, and then output the data
using a list, it calls the subroutine during output.
I found this out by just putting PRINT 'SUBROUTINE' into the SUBR and
running it both ways to see if I was loosing my mind or what???!!! And I
know it's calling it during the sort because when I added the frame color to
the output it was in unsorted order.
The dict item that calls the SUBR is Frame_Color_Cum_Qty. I can sort of
understand that Unidata might be calling the subroutine during sorting, IF
the dict item was involved in the sort. But it's not!
And just in case someone thinks it might be just a display oddity, when I
process the entire file it prints SUBROUTINE 136 times before any of the
Uniquery display occurs, and never prints it even once during the output.
Where as with the SELECT/LIST combo it displays it during output all the way
through the output.
I know what to do to get the report running now, but was just curious if
anyone else had run into this? I also included the SUBR in case someone
wants to see that. It's at the bottom of the message after the two samples
of output. (Oh, and this is already so long, please remember to snip any
responses so the low bandwidth people won't hate me!)
First example where the result is not correct due to the calling of the SUBR
during sort, and not during output:
SUBROUTINE
SUBROUTINE
SUBROUTINE
SORT FLAT.SHD BY Frame_Color BREAK.ON Frame_Color TOTAL Qty
Frame_Color_Cum_Qty
14:00:15 Feb 25 2008 1
Cumulative
FLAT.SHD.. Frame Qty.. Quantity..
810R*1 0641120120
811F*2 0641100100
975A1*10641 1950 1950
* -
0641 2170
Second example where the result is correct:
SELECT FLAT.SHD BY Frame_Color BY Ship_Date
LIST FLAT.SHD Frame_Color BREAK.ON Frame_Color TOTAL Qty Frame_Color_Cum_Qty
Cumulative
FLAT.SHD.. Frame Frame Qty.. Quantity..
810R*1 0641 0641120120
SUBROUTINE
811F*2 0641 0641100220
SUBROUTINE
975A1*10641 0641 1950 2170
SUBROUTINE
* -
0641 2170
SUBROUTINE FRAME.QTY.CUM(RETURN.VALUE, FRAME.COLOR, QUANTITY)
* CLIENT.NAME.WITHHELD - Release 7.1
* FRAME.QTY.CUM - Cumulative Tot for QTY by FRAME by COLOR on
SHADE.TALLY.BY.DIECUT
Version=~Ver=~7.1.18~50079977~
* Written Allen E. Elwood 02/02/08
*#* COPY COPY.TOOLS.BP STANDARD.COMMON ;*#* Copied Source Follows (02-21-08)
$INCLUDE STANDARD.COMMON.VARIABLES FROM COPY.TOOLS.BP
$INCLUDE STANDARD.COMMON.APP.PROGRAMS FROM COPY.TOOLS.BP
*#*
COMMON /FRAMEQ/COMMON.ARRAY(3)
*
* Prime common vars
IF 0 THEN
EQU FIRST.TIME TO COMMON.ARRAY(1)
EQU PREV.FRAME.COLOR TO COMMON.ARRAY(2)
EQU RUNNING.TOTALTO COMMON.ARRAY(3)
END
PRINT 'SUBROUTINE'
*
* Init this run
IF FIRST.TIME # @DATE:@TIME:@WHO THEN
FIRST.TIME = @DATE:@TIME:@WHO
PREV.FRAME.COLOR =
RUNNING.TOTAL= 0
END
*
* Logic and addition
BEGIN CASE
CASE PREV.FRAME.COLOR = ''
RUNNING.TOTAL = QUANTITY
CASE PREV.FRAME.COLOR # FRAME.COLOR
RUNNING.TOTAL = QUANTITY
CASE PREV.FRAME.COLOR = FRAME.COLOR
RUNNING.TOTAL+= QUANTITY
CASE 1
RUNNING.TOTAL = 0
END CASE
RETURN.VALUE = RUNNING.TOTAL
PREV.FRAME.COLOR = FRAME.COLOR
RETURN
Allen E. Elwood from Warm and Sunny Southern California
www.tortillafc.com
Quality Code Since 1978
---
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/