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



aaaarrrrrggggggg - fixed form - take it away please!



On Nov 18, 2019, at 9:51 AM, Rishi Seth <rishiseth99@xxxxxxxxx> wrote:

Hi,

But it does not seem to be working please refer below code :-

dv1 s 10
dv2 s 5
dSUBSTRING s 10 VARYING
DPOS S 5U 0
DLEN S 5U 0
DN1 S 2P 0
c eval v1='RISHI'
C EVAL N1=%LEN(V1)
C N1 DSPLY
C V1 DSPLY
C EVAL N1=%LEN(%TRIM(V1))
C N1 DSPLY
C V1 DSPLY
C EVAL V1= %TRIML(V1)
C EVAL N1=%LEN(V1)
C N1 DSPLY
C V1 DSPLY
C EVAL V1= %TRIMR(V1)
C EVAL N1=%LEN(V1)
C N1 DSPLY
C V1 DSPLY
C EVAL LEN=%SCAN(' ':V1)
C LEN DSPLY
C EVAL POS=%SCAN(' ':V1)
C EVAL SUBSTRING=%SUBST(V1:1:POS-1)
C EVAL N1=%LEN(SUBSTRING)
C N1 DSPLY
C SUBSTRING DSPLY
C MOVE SUBSTRING V2
C V2 DSPLY
C EVAL *INLR=*ON

when we debug it shows value of v1 as 'RISHIBBBB'

So neither trim nor trimr even substring also does not seem to work as it
shows substring value as 'RISHIBBBBB'

B---Means blanks.



On Mon, Nov 18, 2019 at 3:41 PM Vernon Hamberg <vhamberg@xxxxxxxxxxxxxxx>
wrote:

If you set the value of a variable length (VARCHAR) from a fixed length
(CHAR), trailing blanks are included in the length - I believe this is
clearly stated in the manuals where VARCHARs are documented.

I use the %trim or %trimr BIF to take care of this.

On 11/17/2019 2:52 PM, Rishi Seth wrote:
Hi,

Supportrar there is a field 'x', and each time due to some situation it's
length keeps on varying and after the value of this field if some blanks
appear then how can we remove them so that after removing those blanks
it
should not have any trailing blanks in it?


Thanks

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: https://amazon.midrange.com

--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.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.