× 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.



Hi Peter

I wrote a 'word-wrap' routine for some of my utilities (many years ago)
that sounds like a good fit for what you are trying to do. It's RPG4 but
still does the job! Code is at
http://www.dbg400.net/foswiki/bin/view/DBG400/RpgDBG040R3

Regards, Martin


On 1 May 2013 15:32, Anderson, Kurt <KAnderson@xxxxxxxxxxxx> wrote:

Hi Peter,

I believe I've done this sort of thing before (although not at my current
job, so I don't have source to reference).
Essentially I would do something like substring to the length of the print
field, then step backwards character by character looking for a space. If
I found one, I'd break everything up to the space off and place it in the
PrintField and print. Then I'd continue again this time starting after the
section that got printed and repeat what I just did. If a space isn't
found, you'd simply have to break at the 20th character.

Hopefully this isn't too vague.

-Kurt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Vidal, Peter
Sent: Wednesday, May 01, 2013 9:18 AM
To: Midrange - RPG (rpg400-l@xxxxxxxxxxxx)
Subject: Print a long field into smaller fields

Hello Team!

I would like to have your feedback on this thought / challenge:

I have a description field (let's call it "LongField") which is 64
characters long. I need to print this field but I have only a limited
space of 20 characters. I would like to split the field in such a way that
I can have it printed in this pre-printed form / column. For example:

/=========================/
LongField = "MAN BASIC W/ BUILT IN OSTOMY SUPPORT/BARRIER, MODULAR SYSTEM"

Required Printed Output:
MAN BASIC W/ BUILT
IN OSTOMY
SUPPORT/BARRIER,
MODULAR SYSTEM
/=========================/

I would probably need four fields (20/A) to allow the entire description
to print the way I am suggesting here. Oh well, I believe I have seen this
code being suggested before but I can't find it. As you can see, the
portion of the string "SUPPORT/BARRIER," was not splitted because there are
no spaces in between the words and the slash so I know the routine I saw
before has logic to determine the most appropriate place to "cut" the
string based on the fact if there is enough room space to fit or not. In
this case, cannot be greater than 20 characters, as I stated before.

Any suggestions / advices are really appreciated.

Best regards,
Peter Vidal

________________________________
This communication is intended only for the use of the individual or
entity named as the addressee. It may contain information which is
privileged and/or confidential under applicable law. If you are not the
intended recipient or such recipient's employee or agent, you are hereby
notified that any dissemination, copy or disclosure of this communication
is strictly prohibited. If you have received this communication in error,
please immediately notify CareCentrix Compliance Hot Line at (877)
848-8229 and notify the sender by electronic mail. Please expunge this
communication without making any copies. Thank you for your cooperation.
--
This is the RPG programming on the IBM i (AS/400 and 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 IBM i (AS/400 and 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 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.