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



Bob, it can be done with one based array if the
quantity fields in the file are contiguous.  Here's
an example writing on output file.  Updates would
READ, process the array elements, and UPDATE.

DDS for physical file
---------------------
     A          R WHSSKUR
     A            WH            10
     A            SKU           10
     A            QTY001         7P 0
     A            QTY002         7P 0
     A            QTY003         7P 0
     A            QTY004         7P 0
     A            QTY005         7P 0
     A            QTY006         7P 0
     A            QTY007         7P 0
     A            QTY008         7P 0
     A            QTY009         7P 0
     A            QTY010         7P 0

RPG IV Program
--------------
FWhsSku    o    e             disk
D WhsSkuDS      e ds                  extname(WhsSku:WhsSkuR)
D Qtys            s                   like(Qty001) dim(10) based(QtysP)
D i               s             10i 0
D j               s             10i 0
C                   eval      QtysP = %addr(Qty001)
 * Write 10 records using the Qtys array.
C                   for       i = 1 to 10
C                   eval      wh = 'WH' + %char(i)
C                   eval      sku = 'Sku' + %char(i)
C                   for       j = 1 to 10
C                   eval      Qtys(j) = (j-1) * 10  + i
C                   endfor
C                   write     WhsSkuR
C                   endfor
C                   eval      *inlr = *on


Mel Rothman





"Bob Cozzi (RPGIV)" wrote:
>
> Oops... PTF needed for my example: :)
>
>  If the file is externally described, then it will bring in QTY1, QTY2,
>  QTY3... QTY366.
>
>  There is no way to map them directly into an array named QTY. :(
>  You have to do a data structure
>
>  D  Input       E DS                ExtName(InputFile)
>  D* .... input data fields will appear here (including QTY1... QTY366)
>  D
>
> ****************** CORRECT LINE FOLLOW ***********************
> > D pData          S              *  Inz(%addr(QTY1))
>  D LargeArray     S                 Dim(366) Like(Qty1) based(pData)
>
>  D WorkArray      S                 Dim(366) Like(Qty1)
>
>  In your program the array you're filling up with the quantities is
> named
>  WORKARRAY. You would then just move that array to the LARGEARRAY field
>  and it should work fine---no need to move in a DO Loop.
>
>  C                 MOVE   WORKARRAY              LARGEARRAY
>
>  Bob Cozzi
>  cozzi@rpgiv.com
>  Visit the new on-line iSeries Forums at: http://www.rpgiv.com/forum
>


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.