[Download-List] R18

Spitzner, Eric Eric.Spitzner at quinnipiac.edu
Fri Jul 13 10:19:20 EDT 2007


Pretty much as you would have in the past: use the template field names
and set CRNT.FA.YEAR in the Process Entry Hook. Here, for example, is a
routine I recently re-wrote from an original in UniBASIC:
<<
Application: ST,  Process: QU4.GET.LAST.YR.AWD.PCT - Get need pct met
last year 
 
Process Type.............: B - Batch Virtual Field Subroutine
 
Process Argument:   1. A.PERCENT                    OUT - percent of
need met                                   
                    2. A.STUDENT.ID                 IN - ID of recipient

                    3. A.YEAR                       IN - Current
Academic Year                                  
 
User
Code....................................................................
.......................................
             0001: * 11 Jul 2007  11:12am  Eric Spitzner 
             0002: V.SA.STUDENT.ID = A.STUDENT.ID 
             0003: FOR_THE REFERENCED SA.STUDENT.ID EXISTING 
             0004:    V.CS.STUDENT.ID = V.SA.STUDENT.ID 
             0005:    FOR_THE REFERENCED CS.STUDENT.ID EXISTING 
             0006:       X.CS.NEED = V.CS.NEED - V.CS.BUDGET.ADJ 
             0007:       IF X.CS.NEED GT 0 THEN 
             0008:          FOR_EACH ASSOCIATED SA.AWARD 
             0009:             IF V.SA.AWARD EQ "PELL" | 
             0010:             OR V.SA.AWARD EQ "SEOG" | 
             0011:             OR V.SA.AWARD EQ "CICS" | 
             0012:             OR V.SA.AWARD EQ "QGCT" | 
             0013:             OR V.SA.AWARD EQ "QGRN" | 
             0014:             OR V.SA.AWARD EQ "QGSP" THEN 
             0015:                V.TC.STUDENT.ID = V.CS.STUDENT.ID 
             0016:                V.TC.AWARD.ID = V.SA.AWARD 
             0017:                FOR_THE REFERENCED TC.AWARD.ID 
             0018:                   FOR_EACH ASSOCIATED TC.TA.TERMS
INTO TL.ACYR.ID 
             0019:                      V.AA.ID = V.TL.TERM.ACTION 
             0020:                      FOR_THE REFERENCED AA.ID 
             0021:                         IF V.AA.CATEGORY EQ "D" | 
             0022:                         OR V.AA.CATEGORY EQ "R" THEN 
             0023:                            NULL         ;* Omit
denied and rejected awards 
             0024:                         END ELSE 
             0025:                            X.TOTAL.GIFT +=
V.TL.TERM.AMOUNT ;* Total gift aid 
             0026:                         END 
             0027:                      END_THE AA.ID 
             0028:                   END_EACH TC.TA.TERMS 
             0029:                END_THE TC.AWARD.ID 
             0030:             END 
             0031:          END_EACH SA.AWARD 
             0032:       END 
             0033:    END_THE CS.STUDENT.ID 
             0034:    A.PERCENT = X.TOTAL.GIFT * 100 / X.CS.NEED 
             0035: END_THE SA.STUDENT.ID 
 
          Do BEFORE Main Loop ENTRY
(PRCS.ENTRY)............................................................
..................
 
             0001: * 10 Jul 2007  03:37pm  Eric Spitzner 
             0002: X.YEAR = CRNT.FA.YEAR                   ;* Save the
ambient current year 
             0003: CRNT.FA.YEAR = A.YEAR - 1               ;* Set this
file's year minus one 
             0004: X.TOTAL.GIFT = 0                        ;* Initial
sum 
             0005: A.PERCENT = 0                           ;* Initial
result 
 
          Do upon EXIT from Process
(PRCS.EXIT).............................................................
..................
 
             0001: * 10 Jul 2007  03:37pm  Eric Spitzner 
             0002: CRNT.FA.YEAR = X.YEAR                   ;* Restore
the ambient 
>>
 
The limitation is that you must set CRNT.FA.YEAR before your
program/subroutine opens its files. Thus no routine can access multiple
years by itself. We have, for example, a routine which sums the awards
of a specified category to a given recipient. In the past this was a
single subroutine which used "GOSUB FILE.OPENS" as necessary to examine
all the years for which the recipient had records. For R18 we've split
that routine in two: one which loops through the years, setting
CRNT.FA.YEAR and calling the second; the second to return the awards it
finds processing the year given it.
 
HTH
Eric Spitzner, CDP (eric.spitzner at quinnipiac.edu)
Senior Programmer/Analyst
Quinnipiac University; Hamden, Connecticut
Sun V440; Solaris 2.9; UniData 6.0.9
Colleague 17.0.14 and Benefactor 5.1 

________________________________



HOW DO YOU ACCESS A FILE SUITE (EX. CS.2004 OR TA.2005) IN AN "IS
SUBROUTINE? 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.cedarville.edu/pipermail/download-list/attachments/20070713/10de0ecb/attachment.html>


More information about the download-list mailing list