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


  • Subject: Re: General purpose "level break" logic for RPG.
  • From: Jim Welsh <jimwelsh@xxxxxxxxxxxxx>
  • Date: Sun, 04 Apr 1999 03:33:58 -0400



"John C. Bradley" wrote:

> I thought I saw an article late in 1998 or the first month of 1999 about a
> general purpose RPG approach to "level break" programming.  This did NOT
> mean using the RPG cycle and "L" indicators as I recall, but was more about
> how to use a structured approach to subtotaling.  It looked like it would be
> pretty handy "boiler plate" to avoid always reinventing the wheel.
>
> Does anyone recall where the article appeared?
>
>

Here is a simple level break routine that has served me well.
RPG II is history folks...get with the program already. :-)

Ok Ok Ok...whatever you prefer...
Yes I still use program described print specs.
What do you think ? I'm going to use RLU ? Bwhaahahahaa


     F* Program : IN1026
     F* Written : 12/15/98
     F* Author  : Jim Welsh
     F* Text    : Product Production by Workcenter Report
     F**********************************************************************
     F* Work Center Labor Transactions
     FSFLTP100  IF   E             Disk
     F*
     F* Report File
     FRMSPRT01  O    F  132        Printer Oflind(*InOf)
     D*
     D* Work Fields
     D @cmpno          S             15  5
     D @loiso          S               d   datfmt(*iso)
     D @hiiso          S               d   datfmt(*iso)
     D lodate          S               d   datfmt(*usa)
     D hidate          S               d   datfmt(*usa)
     D*
     D QtyGood1        S             11  0
     D QtyGood2        S                   like(QtyGood1)
     D QtyGood3        S                   like(QtyGood1)
     D QtyGood4        S                   like(QtyGood1)
     D QtyGood5        S                   like(QtyGood1)
     D*
     D ActHrs1         S             10  3
     D ActHrs2         S                   like(ActHrs1)
     D ActHrs3         S                   like(ActHrs1)
     D ActHrs4         S                   like(ActHrs1)
     D ActHrs5         S                   like(ActHrs1)
     D*
     D ErnHrs1         S             10  5
     D ErnHrs2         S                   like(ErnHrs1)
     D ErnHrs3         S                   like(ErnHrs1)
     D ErnHrs4         S                   like(ErnHrs1)
     D ErnHrs5         S                   like(ErnHrs1)
     D*
     D EffWork         S              7  5
     D EffPct1         S              7  3
     D EffPct2         S                   like(EffPct1)
     D EffPct3         S                   like(Effpct1)
     D EffPct4         S                   like(EffPct1)
     D EffPct5         S                   like(EffPct1)
     D*
     D* Input Key Data Structure
     D InKey           DS
     D  wcnt1
     D  wcnt2
     D  trprd
     D  trseq
     D*
     D* Saved Key Data Structure
     D SvKey           DS
     D  svwcnt1                            like(wcnt1)
     D  svwcnt2                            like(wcnt2)
     D  svtrprd                            like(trprd)
     D  svtrseq                            like(trseq)
     C*
     C/Title - Initialization
     C*---------------------------------------------------------------------
     C     *Entry        Plist
     C                   Parm                    @cmpno
     C                   Parm                    @loiso
     C                   Parm                    @hiiso
     C*
     C                   Move      @loiso        lodate
     C                   Move      @hiiso        hidate
     C*
     C                   Eval      *InOf = *On
     C*
     C/Title - Mainline
     C*---------------------------------------------------------------------
     C                   Read      VLT100                                 90
     C                   Eval      SvKey = InKey
     C     *IN90         DowEq     *Off
     C*
     C     InKey         IfNe      SvKey
     C                   ExSr      Break
     C                   Eval      SvKey = InKey
     C                   EndIf
     C*
     C                   ExSr      Detail
     C*
     C                   Read      VLT100                                 90
     C                   EndDo
     C*
     C                   ExSr      prtgrand
     C
     C                   Eval      *InLr = *On
     C*
     C/Title - Subroutines
     C*---------------------------------------------------------------------
     C* Detail Subroutine
     C*---------------------------------------------------------------------
     C     Detail        Begsr
     C                   Add       lelp1         ActHrs1
     C                   Add       bearn         ErnHrs1
     C                   Add       lqygd         QtyGood1
     C                   EndSr
     C*
     C/Eject
     C*---------------------------------------------------------------------
     C* Break Subroutine
     C*---------------------------------------------------------------------
     C     Break         Begsr
     C     wcnt1         IfNe      svwcnt1
     C                   Exsr      wcnt1brk
     C                   Else
     C     wcnt2         IfNe      svwcnt2
     C                   Exsr      wcnt2brk
     C                   Else
     C     trprd         IfNe      svtrprd
     C                   Exsr      trprdbrk
     C                   Else
     C                   Exsr      trseqbrk
     C                   Endif
     C                   Endif
     C                   Endif
     C                   EndSr
     C*
     C/Eject
     C*---------------------------------------------------------------------
     C* Work Center ( Department ) Break
     C*---------------------------------------------------------------------
     C     wcnt1brk      BegSr
     C*
     C                   ExSr      wcnt2brk
     C*
     C* Calc...
     C     ActHrs4       IfNe      0
     C     ErnHrs4       Div(h)    ActHrs4       EffWork           7 5
     C     EffWork       Mult(h)   100           EffPct4           7 3
     C                   Else
     C                   Eval      EffPct4 = *Zeros
     C                   EndIf
     C* Print...
     C                   Exsr      Headings
     C                   Except    Total4
     C*
     C* Accum...
     C                   Add       QtyGood4      QtyGood5
     C                   Add       ActHrs4       ActHrs5
     C                   Add       ErnHrs4       ErnHrs5
     C* Clear..
     C                   Clear                   QtyGood4
     C                   Clear                   ActHrs4
     C                   Clear                   ErnHrs4
     C*
     C                   EndSr
     C*
     C/Eject
     C*---------------------------------------------------------------------
     C* Work Center ( Sub-Department ) Break
     C*---------------------------------------------------------------------
     C     wcnt2brk      BegSr
     C*
     C                   ExSr      trprdbrk
     C*
     C* Calc...
     C     ActHrs3       IfNe      0
     C     ErnHrs3       Div(h)    ActHrs3       EffWork           7 5
     C     EffWork       Mult(h)   100           EffPct3           7 3
     C                   Else
     C                   Eval      EffPct3 = *Zeros
     C                   EndIf
     C* Print...
     C                   Exsr      Headings
     C                   Except    Total3
     C*
     C* Accum...
     C                   Add       QtyGood3      QtyGood4
     C                   Add       ActHrs3       ActHrs4
     C                   Add       ErnHrs3       ErnHrs4
     C* Clear..
     C                   Clear                   QtyGood3
     C                   Clear                   ActHrs3
     C                   Clear                   ErnHrs3
     C*
     C                   EndSr
     C*
     C/Eject
     C*---------------------------------------------------------------------
     C* Product Break
     C*---------------------------------------------------------------------
     C     trprdbrk      BegSr
     C*
     C                   ExSr      trseqbrk
     C*
     C* Calc...
     C     ActHrs2       IfNe      0
     C     ErnHrs2       Div(h)    ActHrs2       EffWork           7 5
     C     EffWork       Mult(h)   100           EffPct2           7 3
     C                   Else
     C                   Eval      EffPct2 = *Zeros
     C                   EndIf
     C* Print...
     C                   Exsr      Headings
     C                   Except    Total2
     C*
     C* Accum...
     C                   Add       QtyGood2      QtyGood3
     C                   Add       ActHrs2       ActHrs3
     C                   Add       ErnHrs2       ErnHrs3
     C*
     C* Clear..
     C                   Clear                   QtyGood2
     C                   Clear                   ActHrs2
     C                   Clear                   ErnHrs2
     C*
     C                   EndSr
     C*
     C/Eject
     C*---------------------------------------------------------------------
     C* Operation Sequence Break
     C*---------------------------------------------------------------------
     C     trseqbrk      BegSr
     C*
     C* Calc...
     C     ActHrs1       IfNe      0
     C     ErnHrs1       Div(h)    ActHrs1       EffWork           7 5
     C     EffWork       Mult(h)   100           EffPct1           7 3
     C                   Else
     C                   Eval      EffPct1 = *Zeros
     C                   EndIf
     C*
     C* Print...
     C                   Exsr      Headings
     C                   Except    Total1
     C*
     C* Accum...
     C                   Add       QtyGood1      QtyGood2
     C                   Add       ActHrs1       ActHrs2
     C                   Add       ErnHrs1       ErnHrs2
     C* Clear...
     C                   Clear                   QtyGood1
     C                   Clear                   ActHrs1
     C                   Clear                   ErnHrs1
     C*
     C                   EndSr
     C*
     C/Eject
     C*---------------------------------------------------------------------
     C* Print Grand Totals
     C*---------------------------------------------------------------------
     C     prtgrand      BegSr
     C*
     C                   Exsr      wcnt1brk
     C*
     C     ActHrs5       IfNe      0
     C     ErnHrs5       Div(h)    ActHrs5       EffWork           7 5
     C     EffWork       Mult(h)   100           EffPct5           7 3
     C                   Else
     C                   Eval      EffPct5 = *Zeros
     C                   EndIf
     C*
     C                   Exsr      Headings
     C                   Except    Total5
     C*
     C                   EndSr
     C/Eject
     C*---------------------------------------------------------------------
     C* Headings
     C*---------------------------------------------------------------------
     C     Headings      BegSr
     C     *InOf         IfEq      *On
     C                   Except    Heading1
     C                   Eval      *INOF = *Off
     C                   EndIf
     C                   EndSr
     C*
     O/EJECT
     O*---------------------------------------------------------------------
     O* Report Specs
     O*---------------------------------------------------------------------
     ORMSPRT01  E            Heading1    1     3
     O                                           10 'IN1026    '
     O                       *Date         Y   +  5
     O                                           85 'XYZ COMPANY'
     O                                          127 'Page'
     O                       Page          Z    132
     O*
     O          E            Heading1    1
     O                                           88 'Product Production by 
Work-
     O                                              center'
     O          E            Heading1    1
     O                                            9 'From Date'
     O                       lodate             + 1
     O                                          + 1 'To Date'
     O                       hidate             + 1
     O*
     O          E            Heading1    2
     O                                            4 '    '
     O                                          + 1 '           '
     O                                          + 2 '               '
     O                                          + 2 '  Op.'
     O                                          + 2 '    Quantity'
     O                                          + 2 '      Actual'
     O                                          + 2 '      Earned'
     O                                          + 2 '        '
     O*
     O          E            Heading1    1
     O                                            4 '    '
     O                                          + 1 'Work Center'
     O                                          + 2 'Product        '
     O                                          + 2 '  Seq'
     O                                          + 2 '       Good '
     O                                          + 2 '       Hours'
     O                                          + 2 '       Hours'
     O                                          + 2 '   Eff %'
     O*
     O          E            Total1      1
     O                                            4 '    '
     O                       svwcnt1       Z    + 1
     O                       svwcnt2       Z    + 1
     O                       wcnt3         Z    + 1
     O                       svtrprd            + 2
     O                       svtrseq       Z    + 2
     O                       QtyGood1      L    + 2
     O                       ActHrs1       L    + 2
     O                       ErnHrs1       L    + 2
     O                       EffPct1       L    + 2
     O*
     O* svtrprd totals
     O          E            Total2      1  1
     O                                            4 '   *'
     O                       svwcnt1       Z    + 1
     O                       svwcnt2       Z    + 1
     O                       wcnt3         Z    + 1
     O                       svtrprd            + 2
     O                                          + 2 '     '
     O                       QtyGood2      L    + 2
     O                       ActHrs2       L    + 2
     O                       ErnHrs2       L    + 2
     O                       EffPct2       L    + 2
     O                                          + 1 '*   '
     O*
     O* wcnt2 totals
     O          E            Total3      1  1
     O                                            4 '  **'
     O                       svwcnt1       Z    + 1
     O                       svwcnt2       Z    + 1
     O                                          + 1 '   '
     O                                          + 2 '               '
     O                                          + 2 '     '
     O                       QtyGood3      L    + 2
     O                       ActHrs3       L    + 2
     O                       ErnHrs3       L    + 2
     O                       EffPct3       L    + 2
     O                                          + 1 '**  '
     O* wcnt1 totals
     O          E            Total4      1  2
     O                                            4 ' ***'
     O                       svwcnt1       Z    + 1
     O                                          + 1 '   '
     O                                          + 1 '   '
     O                                          + 2 '               '
     O                                          + 2 '     '
     O                       QtyGood4      L    + 2
     O                       ActHrs4       L    + 2
     O                       ErnHrs4       L    + 2
     O                       EffPct4       L    + 2
     O                                          + 1 '*** '
     O*
     O* Grand Totals
     O          E            Total5      2
     O                                            4 '****'
     O                                          + 1 '   '
     O                                          + 1 '   '
     O                                          + 1 '   '
     O                                          + 2 '               '
     O                                          + 2 '     '
     O                       QtyGood5      L    + 2
     O                       ActHrs5       L    + 2
     O                       ErnHrs5       L    + 2
     O                       EffPct5       L    + 2
     O                                          + 1 '****'


--
Jim Welsh
Programmer/Analyst
Halkey-Roberts Corporation - St. Pete FL
727-577-1300 x279
http://www.netcom.com/~jimwelsh/welcome/welcome.html
mailto:jimwelsh@ix.netcom.com




+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


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.