If you are still using version 3.4.n, you can accumulate amounts quite
easily, the example is a simple accumulator, but extended totals or
other calculatiopns could be readily accumulated instead. We compile
with
BASIC ABP item.nm (V
to make the internal variables persistent and global.
INCLUDE qbasicrclcommon
*
IF NOT(ASSIGNED(INITIATED)) OR NOT(INITIATED) THEN
INITIATED = 1
CUM.AMT = 0
END
*
CUM.AMT = CUM.AMT + C.DATA
*
C.DATA = CUM.AMT
*
RETURN
*
This will also allow you to load multiple data columns from one set of
calcuations using ordinary common variables:
INCLUDE qbasicrclcommon
*
COMMON ABP1, ABP2, ABP3
*
.....
ABP1 = CALC1
APB2 = CALC2
ABP3 = CALC3
*
C.DATA = CALC0
*
RETURN
Each calculated column would look like this:
INCLUDE qbasicrclcommon
*
COMMON ABP1, ABP2, ABP3
*
C.DATA = ABP1 {or 2 or 3}
This method is not available in version 4 or later. For those
versions, as far as I can tell, it is impossible to accumulate data
from item to item and initialize those totals within a single jQL
statement because the persistent values can only be located within a
named common that will retain values not only between iterations but
also between queries. One would have to run a statnd alone program to
which clears the named common before every jQL statement that uses
persistent values, including opened secondary fles.
Brennan
On Nov 14, 5:34 am, Daniel Klein <[email protected]> wrote:
> There are no @variables for any of the access() array elements. However, if
> you want built-in symbolic names then use 'INCLUDE qbasiccommonseq'
> (instead of 'INCLUDE qbasiccommonpick') which gives you 'ItemCount' as an
> EQUated value.
>
> Dan
>
>
>
> On Sat, Nov 12, 2011 at 8:53 PM, Charlie Noah <[email protected]> wrote:
> > Dan,
>
> > I use a subroutine that works with a Universe type I-descriptor in UV
> > emulation mode. I started using that way back when I couldn't get the Pick
> > type subroutine call to work, at least in UV mode. Is there an @variable
> > comparable to ItemCount (Access(4))?
>
> > Thanks,
> > Charlie
>
> > On 11-12-2011 6:00 PM, Charlie Noah wrote:
>
> > Dan,
>
> > I completely missed that. I'll get back in my box now.
>
> > Charlie
>
> > On 11-12-2011 5:44 PM, Daniel Klein wrote:
>
> > Charlie,
>
> > That's what
>
> > IF ItemCount = 1 THEN runningtotal = 0
>
> > does.
>
> > Dan
>
> > On Sat, Nov 12, 2011 at 10:06 AM, Charlie Noah <[email protected]> wrote:
>
> >> Don't forget to clear the common variable before each report, otherwise
> >> you'll end up with strange results.
>
> >> Charlie Noah
>
> >> Tiny Bear's Wild Bird Store
> >> "Everything For The Backyard Bird Enthusiast, Except For The Birds"
> >> Info, Forum: http://www.TinyBearMarketing.com
> >> Store: http://Stores.TinyBearMarketing.com
>
> >> On 11-12-2011 7:21 AM, comp.lang.smalltalk wrote:
>
> >> There is nothing intrinsic in jBASE (or any other multi-value
> >> implementation that I know of) that can do running totals.
>
> >> A dictionary subroutine would be able to accomplish this. Here is a
> >> simple example:
>
> >> Create a file called TEST with 3 records:
>
> >> A
> >> 001 1
>
> >> B
> >> 001 2
>
> >> C
> >> 001 3
>
> >> Create this subroutine:
>
> >> 0001 SUBROUTINE runtot
> >> 0002 COMMON /runtot/ runningtotal
> >> 0003 INCLUDE qbasiccommonpick
> >> 0004 EQU ItemCount TO access(4)
> >> 0005 IF ItemCount = 1 THEN runningtotal = 0
> >> 0006 runningtotal += access(3)<1>
> >> 0007 newpick(12) = runningtotal
> >> 0008 RETURN
>
> >> Create this dictionary:
>
> >> RT
> >> 001 A
> >> 002 1
> >> 003
> >> 004
> >> 005
> >> 006
> >> 007
> >> 008 CALL runtot
> >> 009 R
> >> 010 6
>
> >> jsh ~ -->LIST TEST *A1 RT
>
> >> TEST.......... *A1........... RT....
>
> >> A 1 1
> >> B 2 3
> >> C 3 6
>
> >> You would have to perform the BASIC equivalent of
>
> >> A;S(N(MATERIAL-COST) * N(MULT)R)
>
> >> and plug that into the code in place of 'access(3)<1>'.
>
> >> I know stuff ;-)
>
> >> Dan
>
> >> On Nov 10, 2:32 pm, wsw <[email protected]> <[email protected]> wrote:
>
> >> Is there a way to obtain a running total for a single value attribute
> >> using a dictionary entry? Using A;S(N(MATERIAL-COST) * N(MULT)R),
> >> where MULT = 1, I can obtain the total value of a multivalue
> >> attribute.
>
> >> Thanks,
>
> >> WW
>
> >> --
> >> Please read the posting guidelines at:
> >>http://groups.google.com/group/jBASE/web/Posting%20Guidelines
>
> >> IMPORTANT: Type T24: at the start of the subject line for questions
> >> specific to Globus/T24
>
> >> To post, send email to [email protected]
> >> To unsubscribe, send email to [email protected]
> >> For more options, visit this group at
> >>http://groups.google.com/group/jBASE?hl=en
>
> > --
> > Please read the posting guidelines at:
> >http://groups.google.com/group/jBASE/web/Posting%20Guidelines
>
> > IMPORTANT: Type T24: at the start of the subject line for questions
> > specific to Globus/T24
>
> > To post, send email to [email protected]
> > To unsubscribe, send email to [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/jBASE?hl=en
>
> > --
> > Please read the posting guidelines at:
> >http://groups.google.com/group/jBASE/web/Posting%20Guidelines
>
> > IMPORTANT: Type T24: at the start of the subject line for questions
> > specific to Globus/T24
>
> > To post, send email to [email protected]
> > To unsubscribe, send email to [email protected]
> > For more options, visit this group at
> >http://groups.google.com/group/jBASE?hl=en- Hide quoted text -
>
> - Show quoted text -
--
Please read the posting guidelines at:
http://groups.google.com/group/jBASE/web/Posting%20Guidelines
IMPORTANT: Type T24: at the start of the subject line for questions specific to
Globus/T24
To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en