|
Then when %len(%trim(#text)) approaches %len(#text) you can write out your subfile record and blank out #text. Otherwise, put #text into it's own array and write out your subfile from that array later. You might be able to do something like: myds ds 60 dim(25) subelem 12 dim(5) x=1; z=1; for y=1 to %elem(parm1); if parm1(y)<>' '; myds(x).subelem(z)=parm1(y)+', '; z+=1; if z>%elem(myds.subelem); z=1; x+=1; endif; /* overflow on number of elements per line */ endif; /* This element of the parameter is not blank */ EndFor; /* maybe some logic at the end to dispose of last trailing comma */ But then, myds is 60 characters, not 55. Can you dig? And if parm1(y)='abc12 ' then myds may have 'abc12 , 2222222222, 3333333333, ...' Understand? Basically the comma might have some leading blanks. Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin fkany@xxxxxxxxxxxxxxxxxx Sent by: rpg400-l-bounces@xxxxxxxxxxxx 05/15/2003 10:41 AM Please respond to RPG programming on the AS400 / iSeries To: CN=RPG programming on the AS400/O=iSeries <rpg400-l@xxxxxxxxxxxx> cc: Fax to: Subject: Re: /FREE calculations help Yes, that's what I want to try to do. But when the next element of the array is not blank I want to add the data onto #TEXT instead of over writing it. I want to end result(#TEXT) to look something like this: 1111111111, 2222222222, 3333333333, 4444444444, 5555555555 6666666666, 7777777777, 8888888888, 9999999999 rob@xxxxxxxxx@midrange.com on 05/15/2003 10:06:53 AM Please respond to RPG programming on the AS400 / iSeries <rpg400-l@xxxxxxxxxxxx> Sent by: rpg400-l-bounces@xxxxxxxxxxxx To: RPG programming on the AS400/iSeries <rpg400-l@xxxxxxxxxxxx> cc: Subject: Re: /FREE calculations help I don't quite understand your question. Are you saying: If #TEXT is 55 characters and parm1(p) is 10, and is not blank, then you want to do something like: #text = %trim(#text) + ', ' + %trim(parm1(p)); /* with some additional logic for when #text approaches 55 characters, etc */ By the way, you may want to consider dropping the Do loop and using a FOR loop. for p = 1 to 100; parm1(p).... EndFor; Rob Berendt -- "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." Benjamin Franklin fkany@xxxxxxxxxxxxxxxxxx Sent by: rpg400-l-bounces@xxxxxxxxxxxx 05/15/2003 09:47 AM Please respond to RPG programming on the AS400 / iSeries To: RPG400-L@xxxxxxxxxxxx cc: Fax to: Subject: /FREE calculations help I have a parameter field being passed into an RPGLE program: ================================== D Parm1 S 10A DIM(100) ================================== If any element of the array is populated, I would like to fill as much of each subfile field(55 characters long) on the screen as possible. How would you handle this processing. We're running V5R1. I'm trying to use /FREE format to code this. I got about this far and ran out of ideas: ================================== // Populate Text Fields P = 0; DOU P = 100; P = P + 1; IF Parm1(P) <> *BLANKS; #TEXT = Parm1(P) + ', '; ENDIF; ENDDO; =================================== _______________________________________________ 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. _______________________________________________ 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.
As an Amazon Associate we earn from qualifying purchases.
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.