move left with dynamics --> NAT0232

Hello all!

I don’t understand why MOVE LEFT doesn’t work with Dynamic target fields. Is there a reason?
Sample:

define data local
01 #a10 (A10)         init <'    abc'>
01 #a   (A)   DYNAMIC init <'    def'>
01 #i4  (I4)
end-define
display #a10 #a (AL=10)
*
move left #a10 to #a10  /* works fine
move left #a to #a      /* NAT0232 here
*
*                         /* so we have to do a for-loop
for #i4 = 1 to *LENGTH(#a)
  if substr(#a,#i4,1) ne " "
    move substr (#a,#i4) to #a
    escape bottom
  end-if
end-for
display #a10 #a (AL=10)
*
end

What do you think the result of move left is:

  • remove leading blanks?
  • remove leading and trailing blanks?
  • leave the dynamic the same size an remove leading blanks and fill up with blanks up to the original *length()?

Your example would be more equal to the #A10 example if you use:

01 #a   (A)   DYNAMIC init <'    def   '> 

and then you should check *length(#a), too.

If you want to remove leading/trailing blanks may use *trim() on the PC/UNIX only,
or a equivalent to move left

compress full #a (pm=i) into #a
move #a (pm=i) to #a

to leave the original *length().

[quote="Weihnachtsb