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



Probably need to provide more business rules on how to determine the
review date and the layout of the primary input file.  

Example, 
Is the review date determine by the hired date, last review date,
seniority Date...


-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Kim Spears
Sent: Thursday, November 09, 2006 10:13 AM
To: RPG400-L@xxxxxxxxxxxx
Subject: How to select for future event

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?

Here is what I have done so far:

*************** Beginning of data
*****************************************
H dftactgrp(*no) bnddir('BINDDIR')

FDB2FILE   IF   E           K DISK

FQPRINT    O    F  198        PRINTER

 /COPY QSOURCE,$DATE_P

D compareDate     S               D

D compareYear     S              4  0

D fileDate        S               D

D fileYear        S              4  0

D runDate         S               D   INZ(D'2006-01-01')

 

C                   DO        365

C                   EVAL      compareDate = runDate + %MONTHS(1)

C                   EVAL      compareYear = %subdt(compareDate : *YEARS)

C                   EXSR      $runDate

C                   EVAL      runDate += %DAYS(1)

C                   ENDDO

 

C                   EVAL      *INLR = *ON

 
************************************************************************
**
C     $runDate      BEGSR

 

C     *LOVAL        SETLL     DB2FILE                            99

C                   READ      DB2FILE                                99

 

C                   DOW       ( *IN99 = *OFF)

 * Convert file date format to ISO format.

C                   EVAL      fileDate = $D5toISO(ehdate)

C                   EVAL      fileYear = %subdt(fileDate : *YEARS)

 

C                   IF        ( fileYear < compareYear )

 

 * Synchronize years so comparison can be made

C                   EVAL      fileDate += %YEARS(compareYear - fileYear)

C                   IF        ( fileDate = compareDate )

C                   EXCEPT    LINE

C                   ENDIF

 

 * If September, April, June or November... extend comparison to 31 days

C                   IF        ( %subdt(runDate : *MONTHS) = 9 ) OR

C                             ( %subdt(runDate : *MONTHS) = 4 ) OR     
C                             ( %subdt(runDate : *MONTHS) = 6 ) OR     
C                             ( %subdt(runDate : *MONTHS) = 11 )       
C                   IF        ( %subdt(runDate : *DAYS) = 30 ) AND     
C                             ( fileDate = compareDate + %DAYS(1) )    
C                   EXCEPT    LINE                                     
C                   ENDIF                                              
C                   ENDIF                                              
                                                                       
C                   ENDIF                                              
                                                                       
C                   READ      DB2FILE                                99
C                   ENDDO                                              
                                                                       
C                   ENDSR                                              
 ******                                                                
OQPRINT    E            LINE       01                                  
O                       FName               16                         
O                       LName               38                         
O                       HDate               46                         
O                       runDate             65
O                       compareDate         87
****************** End of data
********************************************

 

--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing
list 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 thread ...


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.