× 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: How to move string value to right?
  • From: John Carr <74711.77@xxxxxxxxxxxxxx>
  • Date: 26 Aug 97 20:31:45 EDT



>At 05:21 PM 8/25/97 -0400, Dean wrote:

>>Suresh,

>>In a message dated 97-08-25 07:23:59 EDT, you write:

>>> In RPG value for string operation will be moved to left of result
>>>  field.Would anyone please tell me how to move the value to right of result
>>>  field for string operation.

>>I can't remember the OP CODES for the life of me, but Strip left and Strip
>>right commands were added around V2R2.  If your field is the proper size,
>>MOVE should work just as well...
>>HTH,
>>Dean Asmussen

>Doesn't it seem that the answer to this question depends on the version of
>RPG in use? In ILE RPG, EVAL will left-justify everything, and Hans Boldt's
>answer serves well there. OTOH, MOVE takes care of it in all versions.
>Ain't change wonderful?
>Vernon Hamberg


Actually the MOVE (I believe) will not work for the orginal question.

The person is doing a string operation which will create (say for example)
 a 40 byte result field,  of which the nonblank charactors will be LEFT 
Justified(say for example 10 bytes).   The MOVE opcode will not help you 
because you still do not know where the Non-blanks end and where the Blanks
start.   You still must do a series of string operations to RIGHT justify
the charactor data within 40 byte field. Or find the last non-blank and
then do a Substring operation. 

 If you did a move into another 40 byte field, you will still have 
data Left justified.  

Hans's examples are the quickest functions to do just that. 

If using RPGIII you still must do some sort of   1.Find end  2.Substring\
off somehow the non-blanks.

John Carr
EdgeTech

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MAJORDOMO@midrange.com
|    and specify 'unsubscribe MIDRANGE-L' in the body of your message.
| 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.