Booth,

This is best handled by the report itself.

IE, you use an SQL query to returns the detail data to an RPG program
and the RPG program formats and outputs it.

Most decent SQL based report tools should be able to handle your requirement.

Query/400 and Query Manager are not "decent" tools in this context :)

If you want to do this is Query/400 I think you are SOL.

On the other hand, you can get Query Manager to do this.
The best way is to create a user defined function that makes use of
the SQL scratchpad, here's an article:
http://www.itjungle.com/mpo/mpo042403-story02.html

You can also do it with a sub-select, but that quickly becomes an i/o
performance nightmare.

HTH,
Charles Wilt


On Mon, Sep 21, 2009 at 3:43 PM, Booth Martin <booth@xxxxxxxxxxxx> wrote:
There is a debit field and a credit field in the record layout.

The requirement is to print a third column which  is a running total.
In RPG it would be

   runtotal = runtotal + debit  - credit

I want to do this with query but can't figure it out.

Any suggestions?

Thanks.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2020 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].