Avatar of Rozamunda
Rozamunda
 asked on

creating strings

i need to pass a string with combined fields from a trigger buffer

str1        S    50

str1 =  %trim(str1) +  'fld1   ' + fld2 '+...etc;

I am adding those fields in a loop, but when I trim each field the string is
compacted : str1 ='fld1fld2'. I would like to preserve the spaces
IBM System i

Avatar of undefined
Last Comment
Gary Patterson, CISSP

8/22/2022 - Mon
raysonlee

apply trim to individual fields instead of str1, append ' ' to str1 to separate next field in your loop
Rozamunda

ASKER
I can't because fields  need to have their original padding

  fld1 = %subst( buffer:pos,fldlength) ...etc
i am extrancting them from a buffer (trigger buffer)
raysonlee

i don't understand, if u want to keep those padding and str1 is just a concatenation of all those fields, why u need trimming anything at all?
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
raysonlee

how about
str1 = %trim(str1) + ' ' +fld
ASKER CERTIFIED SOLUTION
Gary Patterson, CISSP

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question