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




Hi Jeff
having come from a mainframe background (WAY too many years to even think
about) a level break program was NOT uncommon.
Its pretty straight forward
For example
The primary file (FILEA) has the following keys

KEY01
KEY02
KEY03
KEY04
KEY05

The logic of the program (in its simplest form) is as follows


Filekey           klist Key01
                  Key02
                  Key03
                  Key04
                  Key05

Filekey           setll Filea
            dou   %eof(Filea)
            read  Filea
            if    not %eof(Filea)
            exsr  ProcFilea
            endif
            exsr  Prockey01
            Print       GRAND TOTALS

            eval  *inlr = *on
Procfilea   begsr
            eval  recsread = recsread + 1
            if    recsread = 1
            eval  Hldkey01=Key01
            eval  Hldkey02=Key02
            eval  Hldkey03=Key03
            eval  Hldkey04=Key04
            eval  Hldkey05=Key05
            endif
            if    Hldkey01 <> Key01
            exsr  Prockey01
            else
            if    Hldkey02 <> Key02
            exsr  Prockey02
            else
            if    Hldkey03 <> Key03
            exsr  Prockey03
            else
            if    Hldkey04 <> Key04
            exsr  Prockey04
            else
            if    Hldkey05 <> Key05
            exsr  Prockey05
            endif
            endif
            endif
            endif
            endif

            Accum totals for Key01
            Accum totals for Key02
            Accum totals for Key03
            Accum totals for Key04
            Accum totals for Key05
            Accum GRAND TOTALS
            endsr
Prockey01   begsr
            exsr  Prockey02
            Print totals for Key01
            Clear totals for Key01
            eval  Hldkey01=Key01
            endsr
Prockey02   begsr
            exsr  Prockey03
            Print totals for Key02
            Clear totals for Key02
            eval  Hldkey02=Key02
            endsr
Prockey03   begsr
            exsr  Prockey04
            Print totals for Key03
            Clear totals for Key03
            eval  Hldkey03=Key03
            endsr
Prockey04   begsr
            exsr  Prockey05
            Print totals for Key04
            Clear totals for Key04
            eval  Hldkey04=Key04
            endsr
Prockey05   begsr
            Print totals for Key05
            Clear totals for Key05
            eval  Hldkey05=Key05
            endsr

Thats it - in a nutshell
Pretty straight forward, just cumbersome.

Now that I've said pretty straight forward, theres going to be something so
blatantly wrong with this, that I'm going to get a kajillion e-mails
telling what is wrong.

Alan Shore




                                                                       
             "Jeff Crosby"                                             
             <jlcrosby@dilgard                                         
             foods.com>                                                 To
             Sent by:                  "'RPG programming on the AS400 /
             rpg400-l-bounces@         iSeries'" <rpg400-l@xxxxxxxxxxxx>
             midrange.com                                               cc
                                                                       
                                                                   Subject
             07/19/2006 10:36          Skeleton for level breaks       
             AM                                                        
                                                                       
                                                                       
             Please respond to                                         
              RPG programming                                          
              on the AS400 /                                           
                  iSeries                                              
             <rpg400-l@midrang                                         
                  e.com>                                               
                                                                       
                                                                       




I'm getting my feet wet with embedded SQL.  Because of this I cannot use
The
Cycle.

Therefore I had to roll-my-own on level breaks.  Believe it or not, I don't
think I've ever had to do that before.  Those L1, L2, etc indicators make
it
so simple it's ridiculous.

Anyway I woke up in the middle of the night realizing I had done nothing to
force all lower level breaks when a higher level break occurs.

Does anyone have a skeleton program with multiple roll-your-own level
breaks
I can peruse?  I may as well find out what else I have forgotten to code
for
at the same time . . .

Thanks.

--
Jeff Crosby
Dilgard Frozen Foods, Inc.
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531

The opinions expressed are my own and not necessarily the opinion of my
company.  Unless I say so.


--
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-Ups:
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.