Hi! thanks for your reply :)
I'm not sure yet how to 'generate' the LASTVALUE (not sure if I can point
to the previous VALUE field, or use something like 'the VALUE field of
record with date(DATE minus 1 day)', but basically I would then create the
LASTVALUE field in a interim database, and then afterwards perform a
'ABS(VALUE-LASTVALUE)' sort of calculation, right?
The date in these databases is noted in *USA format, I don't have to worry
about things like weekends, just calculate the delta of VALUE between the
records in the database :)
Thanks for the link, I'll check it out and see if I can filter out the
info on how to work the LASTVALUE calculation.
Regards,
Rene van der Kraats,
Holland.
Sent: Monday, February 09, 2015 at 9:01 PM
From: "Booth Martin" <booth@xxxxxxxxxxxx>
To: "Midrange Systems Technical Discussion" <midrange-l@xxxxxxxxxxxx>
Subject: Re: Can someone help me with my Query/400 quest? (yes, I know,
it's prehistoric ;)
I would explore using a two step process if for no other reason than
clarity to myself.
First step: using query/400, I would create and populate an interim file
laid out with SYMBOL,JULIANDATE, VALUE, and LASTVALUE. LASTVALUE would
be a result field which is the saved VALUE from the previous record (or
0 if there is a change in SYMBOL).
Second step: straight forward Query/400 report from the interim file.
I say JULIANDATE, but that may well be irrelevant. It isn't clear to me
how to handle weekends, etc.
Here is a link that seems to me to be of interest:
[1]
http://publib.boulder.ibm.com/html/as400/v4r5/ic2931/info/db2/rbaf9mst78.htm
On 2/9/2015 9:53 AM, Rene van der Kraats wrote:
> Hi All,
>
> I hate to ask for help with this as I'm trying to discover as much as
> possible myself, but I'm afraid I'm a bit stuck here.
>
> I'm dabbling with Query/400 (just for entertainment, mind you) but,
never
> having used this program before, it's a bit hard to get into the right
> 'mind-set'.
>
> I have these database files with a layout similar to this:
>
> DATE SYMBOL VALUE
> 01/01/2015 AAA 50
> 01/01/2015 BBB 40
> 01/01/2015 CCC 20
> 01/02/2015 AAA 60
> 01/02/2015 BBB 35
> 01/02/2015 CCC 25
> 01/03/2015 AAA 40
> 01/03/2015 BBB 25
> 01/03/2015 CCC 23
>
> etc...
>
> I'm trying to produce a query where it calculates the delta between
> similar symbols, per day.
>
> So:
>
> 01/01/2015 AAA = 50
> 01/02/2015 AAA = 60 -> delta compared to previous day = 10
> 01/03/2015 AAA = 40 -> delta compared to previous day = 20
>
> ...and so on, for each symbol.
>
> I think I need to build some query result fields roughly like 'delta =
> abs(VALUE(current date) - VALUE(current date - 1))' (I hope this makes
> sense), but I cannot figure out how to do this.
> I've read a boat-load of PDF's, but none really shows me how to approach
> this problem (or perhaps I just don't 'get it' :)
>
> Can someone perhaps push me in the right direction? I know this probably
> can be solved much easier and quicker with other tools, but out of
> curiosity I'd still like to know how this is accomplished in Query/400
:)
>
> Regards,
>
> Rene.
>
--
Booth Martin<br>
[2]www.martinvt.com<br>
(802)461-5349<br>
Skype: booth.martin<br><br>
God does not play dice with the universe.
--
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: [3]
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 [4]
http://archive.midrange.com/midrange-l.
References
Visible links
1.
http://publib.boulder.ibm.com/html/as400/v4r5/ic2931/info/db2/rbaf9mst78.htm
2.
http://www.martinvt.com/
3.
http://lists.midrange.com/mailman/listinfo/midrange-l
4.
http://archive.midrange.com/midrange-l
As an Amazon Associate we earn from qualifying purchases.