If you are receiving an array of structures, you can define the RPG
parameter directly as a multiple-occurrence data structure, or as an
array of structures.
 
 D W_CNT           S             11S 0
 D I_CNT           S             11S 0
  *
 D W_ARYSTRUCT     DS                  OCCURS(128)
 D  W_FIELD                      10A
 D  W_QTY                         6S 0
  *
 C     *ENTRY        PLIST
 C                   PARM                    W_ARYSTRUCT
 C                   PARM                    I_CNT

 C                   FOR       W_CNT = 1 TO I_CNT BY 1
 C                   EVAL      %OCCUR(W_ARYSTRUCT) = W_CNT
  *   Process the data in W_ARYSTRUCT
 C                   ENDFOR
 
Or like this, using an array of data structures.

 D W_CNT           S             11S 0
 D I_CNT           S             11S 0
  *
 D W_ARYSTRUCT     DS                  DIM(128) QUALIFIED
 D  W_FIELD                      10A
 D  W_QTY                         6S 0
  *
 C     *ENTRY        PLIST
 C                   PARM                    W_ARYSTRUCT
 C                   PARM                    I_CNT

 C                   FOR       W_CNT = 1 TO I_CNT BY 1
  *   Process the data in W_ARYSTRUCT(W_CNT)
 C                   ENDFOR

Since W_ARYSTRUCT is qualified, you'd get the subfields using
    W_ARYSTRUCT(W_CNT).W_FIELD
    W_ARYSTRUCT(W_CNT).W_QTY


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.