× 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.



Kim, you have (in my opinion) designed this the wrong way.  The way you
have it designed you are going to read all the records in DB2FILE 365
times.  That means if you have just 10 records in DB2FILE you'll be making
3650 reads on DB2FILE.

You should have DB2FILE as your primary loop of the program, take the date
on the file, use BIF %SUBDT to get the month out of the date on the file.
Then compare that month to the current month.


Check my syntax...  I may mistakenly code something wrong.  Also this is in
free format but everything I use can be used in Fixed Format in at least as
early as V5R1.

// Get today's month, and add one CompareMnth is defined as 2,0
CompareMnth = %SubDT(%Date():*M) + 1;
If CompareMnth = 13;
   CompareMnth = 1;
EndIf;

Read DB2FILE;
DoW not %EoF(DB2FILE);
  FileMnth = %SubDT(DB2FILEDATE:*M);
  If FileMnth = CompareMnth;
     ExSr SendNotification;
  Endif;
  Read DB2FILE;
EndDo;
*InLR = *On;


As you can see in this method that I only read DB2FILE once.   If you want
the program to work even faster could create a new logical that will
substring the month out of the date on the file, and you can then use a
keyed list to only read the month you want.


Ciao!
Michael Schutte



rpg400-l-bounces@xxxxxxxxxxxx wrote on 11/09/2006 11:12:34 AM:

Hello Friends,

I have been looking at this too long and have concluded that I may be
missing something simple.

My assignment is to make an application to notify supervisors that a
review is due for a team member one month in the future. I have tried
several approaches; the first one wound up missing team members (bad),
my current approach duplicates notice events when the previous month is
longer then the succeeding month, i.e. January (better).

I cannot seem to devise a simple way to filter the extra selections,
which leads me to believe that I might be headed in the wrong direction
entirely.

It occurs to me that I may be trying to reinvent the wheel. Does anyone
here have an elegant routine for matching a date in the past to the
current date plus a month, without missing or duplicating events?




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.