|
no, because what if the from date on the file is before the date rangebut
the to date on the file falls within the date range. with your logic,you
are going to miss that record.broken
Michael Schutte
Admin Professional
Bob Evans Farms, Inc.
"The Secret's the Sauce! Enjoy our new Bob-B-Q Pulled Pork Knife & Fork
Sandwich!"
rpg400-l-bounces@xxxxxxxxxxxx wrote on 09/12/2007 11:25:35 AM:
Actually Michael
if your assumption is correct (a pretty good assumption) all you really
need is the FROM date that was entered
then (in somewhat pseudo-code)
Enteredfromdate setll file
eval filefinishedwith = *off
dou filefinishedwith
read file
if not %eof(file)
if Enteredfromdate => Filefromdate and
Enteredfromdate =< Filethrudate
exsr Procrecord
else
eval filefinishedwith = *on
endif
else
eval filefinishedwith = *on
endif
Alan Shore
NBTY, Inc
(631) 244-2000 ext. 5019
AShore@xxxxxxxx
"If you're going through Hell, keep going" - Winston Churchill
rpg400-l-bounces@xxxxxxxxxxxx wrote on 09/12/2007 11:15:31 AM:
Srinivas,
You mentioned that in your file that you have two dates that are
fileout
by Century, year, month and day, which I assume is somekind of daterange.
You also mentioned that the user will be entering a date range. Am Iright
to assume that you want to find all records where the range in the
example...either partially or fully covers the range of the user? For
bewithin
If users keyed date range is... 08/01/2007 through 12/31/2007
You'll expected to get records as shown in the file..
From Date To DateFCC FYY FMM FDD TCC TYY TMM TDD
20 07 01 01 20 07 08 30 Selected, because TO DATE Falls
user Date range...within
20 07 08 01 20 08 01 01 Selected, because FROM DATE Falls
user Date range...
20 07 01 01 20 08 12 31 Selected, because FROM & TO DATE is
before & after the user range...
Is this what your are asking?
If so, I believe the easiest way, but slowest processing way, would
todate
read the whole file and compare the date range in the file to the
thatrange entered by the user.
Maybe it'll be better to actually post your homework assignment so
Forkyou
don't have to do any of the work. HAHA just kidding.
Michael Schutte
Admin Professional
Bob Evans Farms, Inc.
"The Secret's the Sauce! Enjoy our new Bob-B-Q Pulled Pork Knife &
too.toSandwich!"
rpg400-l-bounces@xxxxxxxxxxxx wrote on 09/12/2007 10:55:35 AM:
Hi Srinivas
In the example I was giving I just talked about year, month and day
get
the concept across. You would need to add the century value in
if
My second email explains in more detail about the key lists, etc,
itthat
doesn't then let me know.
In the paragraph after the example bit of code I gave I mention
I-
have
assumed the name RecordDate as being the date field on file MyFile
apurely
for the example, as the example was showing how you would read allrecords
within a date range where the target field was held on the file as
storesingle
date and not as elements. I am intrigued as to why you want to
anytheTDD
dates in their component parts on the file though?[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
All the best
Jonathan
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
On Behalf Of Srinivas Boggula
Sent: 12 September 2007 15:03
To: RPG programming on the AS400 / iSeries
Subject: RE: Dates Problem
Hi Jonathan Mason,
In my logical file I have 8 fields FCC FYY FMM FDD and TCC TYY TMM
toMy user enters data in this way 01082002 TO 31122007
If I create keys in reverse order year month and day how do I point
record, if my records are in century year month format
One more thing why you have used RecordDate and what value does
RecordDate
Will have.
Sorry I'm unable to catch the point.
Thanks in advance
Regards,
Srinivas
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Jonathan Mason
Sent: Wednesday, September 12, 2007 2:22 PM
To: 'RPG programming on the AS400 / iSeries'
Subject: RE: Dates Problem
Hi Srinvas
The key is to have the date in reverse format, in other words Year,
Month
Day as that will put the dates in the correct order. For example,
suppose
you had the following dates:
01/11/07
02/10/07
03/09/07
Sequencing them in DD/MM/YY doesn't give you the correct order or
records.
If you tried to select records from 01/09/07 to 30/09/07 the first
record
you would read would be the 01/11/07 which isn't in the date range.
Depending on how the program was written you may or may not read
still,more
programs in the loop.
If you store the dates on your file in YYMMDD order (or better
SETLLbeuse a
date type field in *ISO format - YYYY-MM-DD) then the records would
in
the following order:
2007-09-01
2007-10-02
2007-11-03
Which is the correct sequence. In your program you can now use
example:totests
position to the 'first' record in your range and have a loop that
the
record you've read against the last date of your range. For
fields<=
FMyFile IF E K Disk
D FromDate s d DatFmt(*ISO)
D ToDate s d DatFmt(*ISO)
C FromDate SetLL(e) MyFile
C DoU (RecordDate > ToDate) or
(%Eof(MyFile))
C Read(e) MyFile
C If Not %Eof(MyFile) and (RecordDate
teststhatToDate)
C ...
C ... do some processing ...
C ...
C EndIf
C EndDo
C Eval *InLR = *On
C Return
Here the assumption is that MYFILE is keyed on RECORDDATE order and
RECORDDATE is a date type field in*ISO format. The DOU statement
to
see whether or not you need to read any more records and the IF
statement
makes sure that the record you read is in the correct range.
All the best
Jonathan
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Srinivas Boggula
Sent: 12 September 2007 09:31
To: RPG programming on the AS400 / iSeries
Subject: Dates Problem
Hi every one,
How do I Select from Date To - To Date in RPGLE
Say suppose I have 20 records in a Physical File and I have 8
infields
it.
Now I want to retrieve from Dates To - To Date.
I tried with the following way created a logical file of eight
----------------------------------------------------------------DISCLAIMandall of them are keyed
In RPGLE program I have created KLIST ( KEY AND KEY1)
C KEY KLIST
C KFLD FDD
C KFLD FMM
C KFLD FCC
C KFLD FYY
C*
C KEY1 KLIST
C KFLD TDD
C KFLD TMM
C KFLD TCC
C KFLD TYY
With the help of KEY & Chain I can able to set pointer to from date
andread the record.
But how do I stop at To-Date.
0004.43 C KEY CHAIN DSPREC 90
Please Can any one guide me on this issue.
Thanks in Advance
Regards,
Srinivas
I want to retrieve records from 10 to 15, I can able to set pointer
read 10th
record using SETLL and READE but how do I Stop at 15th record.
Thanks in Advance
Regards,
Srinivas
iGATE is ranked as 3rd best IT employer in India as per DQ-IDC Best
Employer
Survey-2007
isofER--
-------------------------------------------------------
Information transmitted by this EMAIL is proprietary to iGATE Group
Companies and is intended for use only by the individual
or entity to whom it is addressed and may contain information that
mailingprivileged, confidential, or exempt from disclosure under
applicable law. If you are not the intended recipient of this EMAIL
immediately notify the sender at iGATE or mailadmin@xxxxxxxxx
and delete this EMAIL including any attachments
--
This is the RPG programming on the AS400 / iSeries (RPG400-L)
mailinglist
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L)
----------------------------------------------------------------DISCLAIMER--listEmployer
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
iGATE is ranked as 3rd best IT employer in India as per DQ-IDC Best
Survey-2007
is
of
-------------------------------------------------------
Information transmitted by this EMAIL is proprietary to iGATE Group
Companies and is intended for use only by the individual
or entity to whom it is addressed and may contain information that
mailingprivileged, confidential, or exempt from disclosure under
applicable law. If you are not the intended recipient of this EMAIL
immediately notify the sender at iGATE or mailadmin@xxxxxxxxx
and delete this EMAIL including any attachments
--
This is the RPG programming on the AS400 / iSeries (RPG400-L)
mailinglist
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L)
listlistlistlist
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
To post a message email: RPG400-L@xxxxxxxxxxxx--
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
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.