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



I know I wrote an article somewhere and I was searching the
archives and couldn't find it.  I know it's in my RPG
Skills Accellerator.

Here's a subprocedure I wrote (probably could use a little
updating, it's a little old) for an article at one time.
 Basically what it does is drill down through a BOM file
and print the listing in an indented manner... you may be
able to use part of this, at least for the recursion part
if the BOM file is set up with the item/sequence keys:

     H NOMAIN
      ****************************************************************
     FBOMPF     IF   E           K DISK
     FBOMLSTPT  O    E             PRINTER
      ****************************************************************
      * Prototypes
                                                  *
      ****************************************************************
      /COPY QSRVSRC,P.BOM
      *//////////////////////////////////////////////////////////////*
      * (#BOMList) Print Expanded BOM List
                          *
      *//////////////////////////////////////////////////////////////*
     P #BOMList        B                   EXPORT
      *--------------------------------------------------------------*
     D #BOMList        PI
     D  Item                         15    Const
      *
     D FirstItem       S                   LIKE(BMITEM)
STATIC
     D LastItem        S                   LIKE(BMITEM)
     D LastSeq         S                   LIKE(BMSEQ)
      *
     D Level           S              5  0 STATIC
      *--------------------------------------------------------------*
     C     BOMKey        KLIST
     C                   KFLD                    LastItem
     C                   KFLD                    LastSeq
      *
     C                   eval      Level = (Level + 1)
      *
     C                   if        (Level = 1)
     C                   eval      FirstItem = Item
     C                   eval      @FIRSTITEM = FirstItem
     C                   WRITE     HDG
     C                   endif
      *
     C     Item          SETLL     BOMPF
     C     Item          READE     BOMPF
                                 69
      *
     C                   dow       (not *IN69)
     C                   eval      @ITEM = ' '
      *
     C                   if        (Level > 1)
     C                   eval      %subst(@ITEM:1:Level-1)
= *ALL'.'
     C                   endif
      *
     C                   eval      %subst(@ITEM:(Level)) =
BMSITEM
     C                   eval      @QTY = BMSQTY
      *
     C                   if        (*INOF)
     C                   eval      @FIRSTITEM = FirstItem
     C                   WRITE     HDG
     C                   endif
      *
     C                   WRITE     DETAIL
                              OF
      *
     C                   eval      LastItem = BMITEM
     C                   eval      LastSeq = BMSEQ
     C                   CALLP     #BOMList(BMSITEM)
     C     BOMKey        SETGT     BOMPF
     C     LastItem      READE     BOMPF
                                 69
     C                   enddo
      *
     C                   eval      Level = (Level - 1)
      *--------------------------------------------------------------*
     P #BOMList        E


On Tue, 7 Dec 2004 11:18:31 -0500
 MWalter@xxxxxxxxxxxxxxx wrote:
> There was an article I read somewhere that Brad Stone
> wrote about using
> recursive procedure calls, and this was his example.
> Drilling through a
> bill of material. Maybe someone, (Paging Brad), could
> point you towards
> that article online somewhere.
> 
> Thanks,
> 
> Mark
> 
> Mark D. Walter
> Senior Programmer/Analyst
> CCX, Inc.
> mwalter@xxxxxxxxxx
> http://www.ccxinc.com
> 
> 
>
                                                          
>                 
>              "Guy Henza"
>                                                   
>              <guyhenza@hotmail
>                                             
>              .com>
>                                                      To 
>              Sent by:
>                  rpg400-l@xxxxxxxxxxxx               
>              rpg400-l-bounces@
>                                          cc 
>              midrange.com
>                                                  
>
                                                          
>         Subject 
>                                        Multi-level BOM
>                     
>              12/07/2004 11:00
>                                              
>              AM
>
                                                          
> 
>
                                                          
>                 
>
                                                          
>                 
>              Please respond to
>                                             
>               RPG programming
>                                              
>               on the AS400 /
>                                               
>                   iSeries
>                                                  
>              <rpg400-l@midrang
>                                             
>                   e.com>
>                                                   
>
                                                          
>                 
>
                                                          
>                 
> 
> 
> 
> 
> I have to write some new code to drill down through a BOM
> to get the raw
> materials.  Does any one have some simple code I can
> start with?  that they
> 
> would be willing to share?  I'm having trouble loosing my
> place on the
> parent when I come back from the grandchild.
> 
> Thanks,
> Guy
> 
> 
> --
> 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.
> 
> 
> 
> --
> 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.
> 

Bradley V. Stone
BVS.Tools
www.bvstools.com

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.