× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,

I managed to produce a 'previous date' variable :)

Define Result Fields now has this entry:

Field: 'PRVDATE'
Expression: 'date(DATE) - 1 day' (Geez, was it really that simple??)

Now I need to define a field PRVVAL, which is filled with the contents of
the VALUE field from the record with a date field like PRVDATE.
I'm not sure yet what to put in that 'Expression' field, but at least I'm
making progress!

Next would probably be a query, like you said, which then uses the interim
file produced by the former output to compare VALUE and PRVVAL.

Thanks again!

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.

This thread ...

Replies:

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

This mailing list archive is Copyright 1997-2024 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.