|
Hi Sean,
> 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)
Since I'm a big fan of LIKEDS, I'd convert the data structure to a
"template" (a structure that's just used as a template for creating other
data structures) and then I'd create a copy that's all zeroes to compare
to.
The following code should give you the idea:
DBrnTotal_t DS 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)
DBrnTotal ds likeds(BrnTotal_t)
D dim(999)
D inz(*LIKEDS)
DBrnZeroes ds likeds(BrnTotal_t)
D inz(*LIKEDS)
/free
For Brn = 1 to %elem(BrnTotal);
if (BrnTotal(Brn) <> BrnZeroes);
// do something with subfileds
endif;
endfor;
/end-free
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.