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


  • Subject: Re: Formatting Data in RPG 4
  • From: "Justin Kiteley" <justin@xxxxxxxxxx>
  • Date: Wed, 25 Apr 2001 22:16:43 -0400
  • Organization: Application Solutions Inc.

Peter,Jim and all,

Thanks for the ideas.  The problem I am having is that the input data is
anywhere from 1 to 80 char long, almost always varying in size with spaces
in the data that need to be retained.

Example:  lets say the max length was 20 and i was trying to wrap data to a
larger field, removing unwanted trailing spaces. cap X's represent necessary
spaces small x's unnecessary spaces.  Sorry if it's confusing, I couldn't
think of any other way to explaing it!

Before

record 1  - TestingX12xxxxxxxxxx
record 2  - TestX12XXTestXXXXTst
record 3  - TstX1X23xxxxxxxxxxxx

After (what I am having trouble achieving)

record 1 - TestingX12TestX12XXTestX
record 2 - XXXTstTstX1X23xxxxxxxxx

  I was just wondering if there was an easier (more efficient, less code)
way to do it.  Rather than the circuitous code I have right now.  I suppose
the only answer to the spaces problem is to use checkr to find farthest
right position of data in the field to be wrapped then parse out the data
character by character into the new 80 field using arrays, keeping track of
where you are by counters, and then reading the next record when 80 is
reached.  I'm going to try to adapt Peter's code first and try it out, but
I'm not sure how it will handle the spaces.  I also don't know how much data
will be in the file, so I guess I have to define the "largefield" as large
as possible?  If anybody else has ideas on this don't be shy.  I'll post my
code once I get it working properly if anybody wants to see it.    Again,
thanks for the input!


Justin Kiteley



+---
| This is the RPG/400 Mailing List!
| To submit a new message, send your mail to RPG400-L@midrange.com.
| To subscribe to this list send email to RPG400-L-SUB@midrange.com.
| To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.