Nice, I just tested this... you could also simply do (if you don't want to keep the original timestamp in the logical.
A R TESTF PFILE(TESTTS)
A TIMESTMP L I
A K TIMESTMP
Thanks
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Tuesday, April 12, 2011 5:55 PM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: Key a logical file by date within a timestamp field
Given: create table qtemp/z (z timestamp)
The following LF DDS should make column L with data type DATE [L],
become the key by the data type date for the timestamp data in column Z
with data type TIMESTAMP [Z]:
<code>
R LOZR PFILE(QTEMP/Z)
TEXT('type L over Z')
Z
L L I RENAME(Z)
K L
</code>
Another suggestion was to map [via DDS] the Z to A and then use SST
to substring the 10-byte date portion, but that is not a supported
mapping; searching InfoCenter on logical file dds mapping yielded the a
table under subject "Describing logical file record formats" which shows
that mapping to character is not a supported mapping via DDS LF [in v5r3
and still, by v6r1]:
http://publib.boulder.ibm.com/infocenter/iseries/v6r1m0/topic/dbp/rbafodrflf.htm
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/topic/dbp/rbafodrflf.htm
Regards, Chuck
On 4/12/11 3:48 PM, Alan Shore wrote:
I keep forgetting to specify the release level we are on - which
is 5.4 so I can use neither of your suggestions
Because the file is in chronological order (timestamp) the order
number 1 may in fact be the millionth record on that particular
date, but if I can create a logical by date within that timestamp,
then order number, then order number 1 will be the first for that
date
I may have to create a temporary file, and populate a date field
I just thought that there may have been something equivalent to SST
for timestamp fields
Luis Rodriguez on Tuesday, April 12, 2011 4:33 PM wrote:
Are you running 6.1 or higher? If so, I wonder if using a derived
key would be of help?
Something in the order of
CREATE INDEX MYLIB/MYINDEX ON MYLIB/MYTABLE
(DATE(MY_TIMESTAMP) AS MY_DATE)
Unfortunately, we are stuck here in the dark ages (V5R3), but
maybe this would be doable...
On Tue, Apr 12, 2011 at 3:02 PM, Alan Shore<ashore@xxxxxxxx> wrote:
I have a physical file, that contains a timestamp field (type z) Is
there any way to create a logical over this physical but ONLY using
the date within that timestamp as part of the key?
As always, any and all responses MUCH appreciated
--
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.
________________________________
Notice from Bob Evans Farms, Inc: This e-mail message, including any attachments, may contain confidential information that is intended only for the person or entity to which it is addressed. Any unauthorized review, use, disclosure or distribution is strictly prohibited. If you are not the intended recipient, please contact the sender by reply e-mail and destroy all copies of the original message and any attachments.
As an Amazon Associate we earn from qualifying purchases.