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



You're right.  There is a problem with the precompiler and recursion.

Why would you have to set a bom level?  It doesn't serve any purpose except
maybe in archaic systems which don't support recursion and are thus limited
to x number of levels of bill of materials.  Help me to understand.

Rob Berendt
--
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety."
Benjamin Franklin



                    "Joe Pluta"
                    <joepluta@PlutaBrot       To:     <midrange-l@midrange.com>
                    hers.com>                 cc:
                    Sent by:                  Fax to:
                    midrange-l-admin@mi       Subject:     RE: SQL Existence 
Check
                    drange.com


                    03/13/2002 10:05 AM
                    Please respond to
                    midrange-l






> From: rob@dekko.com
>
> Joe,
>
> Is this what you meant by an Bill of Material Explosion?
(much nsipping)
>      D Child           S                   like(Parent)
>      C/exec sql
>      C+ Declare C1 cursor for
>      C+ Select bchld from mbm
>      C+ where bprod=:parent
>      C/end-exec
>      C/exec sql
>      C+ Open C1
>      C/end-exec
(much nsipping)

Rob, yes, that's the basic concept.  The data movement is a simple
recursion.  However, what happens when you reuse cursor C1?  Simple bill:

CHAIR
  BACK
  LEG
    DOWEL
    SCREW
  SEAT

Declare C1 for CHAIR.  It will have BACK, LEG and SEAT in its view.  You
process BACK, then process LEG.  Since it has components, if you reuse
cursor C1, it will point to DOWEL and SCREW.  When you return out of your
subprocedure, when you attempt to use C1 to position to SEAT, you're in
limbo, no?  Now, if the recursive subprocedure is smart enough to actually
treat the cursor as a private variable (that is, allocate it and put it's
pointer on the stack), then this could be pretty cool, although I begin to
wonder what the overhead is of declaring and opening say, a thousand
cursors
(not an uncommon situation in even a mildly complex bill in the
pharmaceutical or food processing industry).

This sort of stuff is typical in a BOM explosion.  It gets even more
complicated during BOM maintenance when you have to set the BOM level.  In
the above example, DOWEL is currently BOM level 2, but if I have another
BOM
as such:

LOVESEAT
  CUSHION
  FRAME
    LEG
      DOWEL
      SCREW

All of a sudden, LEG is now BOM level 3.  Additionally, DOWEL is moved to
BOM level four.  It can get pretty intense.

Joe


>
>      P BillOfMat       B
>      D BillOfMat       PI
>      D Parent                        15a   CONST
>      D* Local fields
>      D Child           S                   like(Parent)
>      C/exec sql
>      C+ Declare C1 cursor for
>      C+ Select bchld from mbm
>      C+ where bprod=:parent
>      C/end-exec
>      C/exec sql
>      C+ Open C1
>      C/end-exec
>      C/exec sql
>      C+ fetch c1 into :Child
>      C/end-exec
>      C                   dow       sqlcod=*zeros
>      C                   write     printrec
>      C                   callp     BillOfMat(child)
>      C/exec sql
>      C+ fetch c1 into :Child
>      C/end-exec
>      C                   EndDo
>      C/exec sql
>      C+ Close C1
>      C/end-exec
>      P BillOfMat       E
>
> While RPG supports recursion in subprocedures, I am trying to beat the
> precompiler people into submission to stop limiting RPG.
>
> Rob Berendt
> --
> "They that can give up essential liberty to obtain a little temporary
> safety deserve neither liberty nor safety."
> Benjamin Franklin
>
> _______________________________________________
> This is the Midrange Systems Technical Discussion (MIDRANGE-L)
> mailing list
> To post a message email: MIDRANGE-L@midrange.com
> To subscribe, unsubscribe, or change list options,
> visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
> or email: MIDRANGE-L-request@midrange.com
> Before posting, please take a moment to review the archives
> at http://archive.midrange.com/midrange-l.

_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l
or email: MIDRANGE-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.







As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.