|
I'd start at the 25th character and work back until I found the first space. Then you split the text up at that position. Much simpler than scanning forward. >It's quite possible you truncate characters doing this. If you have >all 50 >characters filled with words and you backed up a few characters >to break on >a space into the second 25 character field you'd end up losing a >few >characters on the end of the 50 character string. >Paul I was thinking of this same method -- Start at position 25 and scan (or is it check?) L(eft) for the first space, then yeah, you'll have to figure out from that point forward if you have more then 25 characters worth of data left and split to a third line, or truncate, or whatever you can do within your data restrictions. //CJ/ On 8/22/05, Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx> wrote: > > > > I'd start at the 25th character and work back until I found the first > space. > > Then you split the text up at that position. Much simpler than scanning > > forward. > > This is the way I do it as well, except that I always start in the 26th > spot instead of the 25th. (It's okay for the 25th position to be a > non-space, since that'll still fit into a 25A field) > > > -- > 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.