× 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: Manipulating data into unbroken stream that wraps at 80 char.
  • From: "Charlie Massoglia" <cmassoglia@xxxxxxxxxxx>
  • Date: Sat, 21 Apr 2001 01:53:26 -0400

The following routine is quite old and has not been updated to take advantage of new BIFs but it does work (from my RPG IV for the RPG/400 Programmer book):
 
      *
      *  FOLDR - MODULE TO FOLD TEXT
      *  01 FEB 95 - CHARLES L. MASSOGLIA
      *
      *  COPYRIGHT 1995, MPH, INC., OKEMOS, MI USA ALL RIGHTS RESERVED
      *
     D  $TEXTIN        S            100
     D  $FOLDOUT       S            100
     D  $FOLDAT        S              3P 0
     D  #START         S                   LIKE($FOLDAT)
     D  #STOP          S                   LIKE($FOLDAT)
     D  #LINE          S                   LIKE($FOLDAT)
     D  #FOLDAT        S                   LIKE($FOLDAT)
     D  WORKLINE       S           1001
     D  OUTLINE        S           1001
      *
      ***  ENTRY PARAMETER LIST
      *
     C     *ENTRY        PLIST
     C                   PARM                    $TEXTIN
     C                   PARM                    $FOLDOUT
     C                   PARM                    $FOLDAT
 
  $TEXTIN is text to be folded
 
  $FOLDOUT is folded text returned
 
  $FOLDAT is fold length, e.g. 80, 132, etc.
      *
      ***  INSURE $FOLDAT REQUESTED LENGTH VALID
      *
     C                   IF        $FOLDAT < 1
     C                             OR $FOLDAT > %SIZE($FOLDOUT)
     C                   EVAL      #FOLDAT = 80
     C                   ELSE
     C                   EVAL      #FOLDAT = $FOLDAT
     C                   ENDIF
 
      *
      ***  PARSE INTO LINES OF #FOLDAT REQUESTED LENGTH
      *
     C                   EVAL      WORKLINE = $TEXTIN
     C                   EVAL      $FOLDOUT = ' '
     C                   EVAL      #START = 1
     C                   EVAL      #STOP = #FOLDAT + 1
     C                   EVAL      #LINE = 1
B001 C                   DOW       #START > 0
B002 C                   DOU       %SUBST(WORKLINE:#STOP:1) = ' '
 002 C                   EVAL      #STOP = #STOP - 1
B003 C                   IF        #START >= #STOP
     C                   EVAL      #STOP = #START + #FOLDAT
 003 C                   LEAVE
E003 C                   ENDIF
E002 C                   ENDDO
 001 C                   EVAL      %SUBST(OUTLINE:#LINE:#FOLDAT) =
 001 C                             %SUBST(WORKLINE:#START:#STOP-#START)
     C                   EVAL      #LINE = #LINE + #FOLDAT
 001 C     ' '           CHECK     WORKLINE:#STOP#START
 001 C                   EVAL      #STOP = #START + #FOLDAT
E001 C                   ENDDO
     C                   EVAL      $FOLDOUT = OUTLINE
     C                   RETURN
 
 
Charles L.Massoglia, President
Massoglia Technical Consulting, Inc.
cmassoglia@voyager.net
In MI 517-676-9700 or in NC 919-363-9395
 
 
----- Original Message -----
From: "Justin Kiteley" <justin@asiwms.com>
To: "RPG400 List" <RPG400-L@midrange.com>
Sent: Friday, 20 April, 2001 09:40
Subject: Manipulating data into unbroken stream that wraps at 80 char.

> Hello,
>
>   I'm writing an application that manipulates print streams for output to a
> portable printer attached to a radio frequency terminal.  I've got the
> printer working but have an idea that may speed up the transfer of the print
> stream to the printer.  Presently the data is being sent to the printer from
> an 80 char long field for each line of the print stream. ( print stream
> varies in record length and # of records but never longer than 80)  What
> I've been trying to do with arrays in RPG/400 is strip out the unneccesary
> blanks and place all of the data into a continuos unbroken stream that wraps
> after 80 char.  This data is displayed on a subfile but could be first
> written to a file then displayed.  I think this will greatly increase the
> print times.  Unfortunately I've not been succesful with my attempts so far.
> I'm new to RPGIV so if anyone out there has any idea's of how to do this in
> RPG/400 or RPGIV I'd be very gratefull!
>
>    Here is an example of a stream I'm working with.  Note: there are
> instances where blanks are necessary in the stream but there is always a
> last character before strippable blanks occur.
>
> ~CC¬
> ¬XA¬JMB¬FS¬XZ
> ¬XA¬CVN¬FS¬XZ
> ¬XA¬SS,,,0570¬FS¬XZ
> ¬XA¬MTT¬FS¬XZ
> ¬XA¬MNY¬FS¬XZ
> ¬XA¬MMT¬FS¬XZ
> ¬XA¬MD+10¬FS¬XZ
> ¬XA¬LT     ¬FS¬XZ
> ¬XA¬PRB¬FS¬XZ
> ¬XA¬MCY¬XZ
> ¬XA¬LH0000,0000¬FS¬PON¬FS
>
> Thanks in advance for any ideas on this!
>
> Justin Kiteley
>
justin@asiwms.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 ...

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.