View previous topic :: View next topic
|
Author |
Message |
madlui56
New User
Joined: 08 Aug 2006 Posts: 61 Location: Philippines
|
|
|
|
Hello,
I just want an assisstance with this problem.
We have a field that takes three values.
These values have different lengths.
Example:
1.00 NAME ADDRESS
98.00 NAME ADDRESS
123.00 NAME ADDRESS
Question : How do we move these three fields (where the first field has a variable length) to just one field? In this sense, there is only one space after the first field then the second field then a space then the third.
Thanks! |
|
Back to top |
|
|
sarunkumaar
New User
Joined: 31 Aug 2006 Posts: 15 Location: Chennai, India
|
|
|
|
Use UNSTRING statement to move the fields into 3 different fields with space as delimiter.
i.e get the record value into some field like WS-FIELD having the value of 1.00 NAME ADDRESS
Then use
UNSTRING WS-FIELD DELIMITED BY SPACES INTO WS-FIELD01 WS-FIELD02 WS-FIELD03
Where the fields WS-FIELD01 Will have the value 1.00 and WS-FIELD02 will have NAME and WS-FIELD03 will have ADDRESS |
|
Back to top |
|
|
madlui56
New User
Joined: 08 Aug 2006 Posts: 61 Location: Philippines
|
|
|
|
Hello just to elaborate above problem,
I do have 3 fields there for example.. 1.00 (amount)(space)Name
The question is How can I make the first field to have a single space every after its value regardless of its different length...?
Example: 100.00(single space)(field)
Thanks |
|
Back to top |
|
|
sarunkumaar
New User
Joined: 31 Aug 2006 Posts: 15 Location: Chennai, India
|
|
|
|
Sorry again if i misunderstand your question..
You can use STRING function to append the value with space irrespective of it's length.
STRING WS-AMOUNT SPACE WS-NAME SPACE WS-ADDRESS DELIMITED BY SIZE INTO WS-FIELD |
|
Back to top |
|
|
madlui56
New User
Joined: 08 Aug 2006 Posts: 61 Location: Philippines
|
|
|
|
gREAT..! Thanks so much for the idea. |
|
Back to top |
|
|
|