• Subject: RE: %Trim
  • From: Rob Berendt <rob@xxxxxxxxx>
  • Date: Thu, 27 Aug 1998 15:36:03 -0500

Buck,

You're right.  I included something in the sample I emailed that I did not have 
in the actual code.  Try this instead.
DRecipientDS      DS                                               
D  RecOffSet              1      4B 0                              
D  AddrLen                5      8B 0                              
D  Format                 9     16    INZ('ADDR0100')              
D  DistrType             17     20B 0 INZ(0)                       
D  Reserved              21     24B 0 INZ(0)                       
D  Recipient             25     99    INZ('rob@dekko.com')         
C                   Eval      RecOffSet = %Len(%Trim(RecipientDS)) 
 * In the above RecOffSet will be equal to 29 because the first two
 * subfields will be dropped.                                      
 * Now that RecOffSet has been intialized we will get 37.          
C                   Eval      RecOffSet = %Len(%Trim(RecipientDS)) 
 * In the following RecOffSet will be equal to 37.  And it would be
 * even if it was our first C spec line.                           
C                   Eval      RecOffSet = %Len(%TrimR(RecipientDS))

The big difference is the dropping of the INZ keyword on the first two 
subfields.  That seemed to do the trick.  Without the INZ they get trimmed.  
Sorry.  I shouldn't have prettied up the code prior to the first email without 
testing it.





mcalabro@commsoft.net on 08/27/98 02:33:34 PM
Please respond to MIDRANGE-L@midrange.com@Internet
To:     MIDRANGE-L@midrange.com@Internet
cc:      
Subject:        RE: %Trim

On Thursday, August 27, 1998 10:10 AM, Rob Berendt [SMTP:rob@dekko.com] 
wrote:
> Has anyone noticed how slowwww that %Trim is?   Create an ILE RPG 
program
> with a alpha variable of 32,767 bytes long.  Perform a %Trim operation
> on that field.  Run it in debug.

I did a quickie test of this on my heavily loaded 620.  500 loops of 
%len(%trim(String)).  "String" contains the literal "Short string here". 
 If "String" is declared 20 bytes long, it takes :02.  If "String" is 
delcared 32000 bytes long, it takes 7:54.

> Another thing I've noticed.  There are times when you would think that a
> %Trim should work when you should be using a %TrimR.  For example
> DRecipientDS      DS
> D  RecOffSet              1      4B 0 INZ(0)
> D  AddrLen                5      8B 0 INZ(0)
> D  Format                 9     16    INZ('ADDR0100')
> D  DistrType             17     20B 0 INZ(0)
> D  Reserved              21     24B 0 INZ(0)
> D  Recipient                         Like(RecAddr) INZ('rob@dekko.com')
> C                   Eval      RecOffSet = %Len(%Trim(RecipientDS))
>  * In the above RecOffSet will be equal to 29 because the first two
>  subfields will be dropped.
> * In the following RecOffSet will be equal to 37.
> C                   Eval      RecOffSet = %Len(%TrimR(RecipientDS))

I see 37 in both instances on my V4R2 machine.

Buck Calabro
Commsoft, Albany, NY
mailto:mcalabro@commsoft.net

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


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-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 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.