× 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: Centering Text Within A Field
  • From: "Jansen, Larry" <ljansen@xxxxxxxxxxxxx>
  • Date: Thu, 28 Jun 2001 12:59:54 -0400

Here's some code that should do it...I am sure there are several other
solutions as well

        d length          s              2  0
       * the next field contains the data to be centered

        d data_in         s             40
       * this field just has blanks                                    
        d add_blanks      s             40

                                                                       
        c                   eval      length = %len(%trim(data_in))

        c                   eval      length = (40 - length) / 2

        c                   eval      data_in = %subst(add_blanks:1:length)
+ data_in
                               
                                                                       

-----Original Message-----
From: Ronald A. Alford [mailto:ralford@richmond.k12.va.us]
Sent: Thursday, June 28, 2001 11:58 AM
To: RPG400-L@midrange.com
Subject: Centering Text Within A Field


Hello everyone,
I have a field that is 40 characters long and I would like to center any 
text that comes into this field.  Does anyone know how to do this.  I am 
trying to use OVERLAY but I get an error when I specify the second 
parameter (Start Position) as another field in my program.  HELP !!! :-(

+---
| 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
+---
+---
| 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:

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.