Re: Concat array elements into a string
- From: charles.leviton@xxxxxxxxx
- Date: 19 Apr 2007 14:00:15 -0700
On Apr 19, 4:06 pm, Richard <rip...@xxxxxxxxxxxx> wrote:
On Apr 20, 6:53 am, charles.levi...@xxxxxxxxx wrote:
When you use 'delimited by size' then you are telling it to use the
size of the variable, ie 30 characters or whatever arrayvar is. You
need to use a delimiting character or perhaps " " (two spaces. You
also need to look at the 'with pointer' clause which specifies where
the string is to start.
You need to space fill the output first. Set the pointer to 1.
I upper cased the added parts. Note I removed txtvar from the string
input list. Txtpoint will be updated by each string to give
concatenation.
MOVE SPACES TO TXTVAR
MOVE 1 TO TXTPOINT
perform varying ws-counter from 1 by 1 until ws-counter = 10
IF ( WS-COUNTER > 1 )
STRING "," DELIMITED BY SIZE
INTO TXTVAR WITH POINTER TXTPOINT
END-IF
string arrayvar(ws-counter) delimited by " "
into txtvar WITH POINTER TXTPOINT
end-perform
Thank you both. Especially for the addnl logic to avoid the leading
comma.
.
- References:
- Concat array elements into a string
- From: charles . leviton
- Re: Concat array elements into a string
- From: Richard
- Concat array elements into a string
- Prev by Date: Re: Concat array elements into a string
- Next by Date: Re: The Future
- Previous by thread: Re: Concat array elements into a string
- Next by thread: VisualAge Cobol Compiler prob on XP Pro
- Index(es):
Relevant Pages
|