× 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 saw a thread a while back that prompted me to convert my RPG III program to RPG IV to take advantage of some new features like ds array and the += operator.

So far, it is looking very good. I have a 999 element array and got data into the subfields. Now I want to output any of those elements that are not all zeros. Is there a shortcut? (Using V5R2)

     DBrnTotal         DS                  DIM(999) QUALIFIED
     D BTAM59                              LIKE(CMAM22) INZ(0)
     D BTAM01                              LIKE(CMAM01) INZ(0)
     D BTAM02                              LIKE(CMAM02) INZ(0)
     D BTAM03                              LIKE(CMAM03) INZ(0)
     D BTAM04                              LIKE(CMAM04) INZ(0)
     D BTAM05                              LIKE(CMAM05) INZ(0)
     D BTAM06                              LIKE(CMAM06) INZ(0)
     D BTAM07                              LIKE(CMAM07) INZ(0)
     D BTAM08                              LIKE(CMAM08) INZ(0)
     D BTAM09                              LIKE(CMAM09) INZ(0)
     D BTAM10                              LIKE(CMAM10) INZ(0)

... Many additions into the subfields as I accumulate totals

     /FREE
          For Brn = 1 TO 999;
            If BrnTotal(Brn) <> *ZERO;
              // DO STUFF WITH SUBFIELDS;
            EndIf;
          EndFor;
     /END-FREE

... All 999 records show up.

Any suggestions other than

If BrnTotal(Brn).BTAM59 <> 0 OR BrnTotal(Brn).BTAM01 <> 0 OR ... etc


P.S. Since I only have DIM(999) why did it not run with BRN as 3,0? I had it LIKE(my branch number field) but changed to 10I0 after the error. (Got "The target for a numeric operation is too small to hold the result" when it hit the For loop.)



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.