Page 1 of 1

Concat String fields delimiter spaces

PostPosted: Sat Mar 01, 2008 1:29 am
by Irene Ioujanina
Good afternoon,
May I please ask for the following:
....
07 IN1 PIC X(20) VALUE "701 STREET DR "
07 in2 PIC X(15) value "nEW yORK cITY "
07 in3 PIC X(10) VALUE "SOME "
07 OUT PIC X(60).

I need to do a simple thing: to conc atinate IN1 + spase + IN2 + space + IN3 to receive in OUT
"701 STREET DR nEW yORK cITY SOME "
When I'm using STRING... DELIMITED BY space-> it trimmed all spaces
I can filnd the length od each string and take a substring, for instance
IN1(1:length of IN1) -> DOES NOT GIVE ME A LOT, how to put them all in OUT???...

All IN1,2,3 can not be variable length-they are coming from the Input file,fixed length..

Appreciate your help.
Thanking in advance,

Re: Concat String fileds delimiter spaces

PostPosted: Sat Mar 01, 2008 1:56 am
by CICS Guy
Try string delimited by two spaces......

Re: Concat String fileds delimiter spaces

PostPosted: Sat Mar 01, 2008 2:12 am
by Irene Ioujanina
Thank you for review..

Tried. It trims all spaces anyway...
STRING
IN1 " "
IN2 " "
IN3 " "
DELIMITED BY SPACE
INTO OUT

gives OUT as
"701STREETDRnEWyORKcITYSOME"
I think ,the keyword is here "DELIMITED BY SPACE " - it just omit all the spaces everywhere in the fields...

Thank you,

Re: Concat String fileds delimiter spaces

PostPosted: Sat Mar 01, 2008 2:23 am
by dick scherrer
Hello,

Use
DELIMITED BY '  '
Note that there are 2 spaces between the quotes (per CG's suggestion).

Re: Concat String fileds delimiter spaces

PostPosted: Sat Mar 01, 2008 2:39 am
by Irene Ioujanina
Thank you very much, everyone.
Put 2 spaces instead of one-the result is much better (thanks!):
"701 STREET DRnEW yORK cITYSOME"

modified delimiter between fields to ','
STRING
IN1 ", "
IN2 ", "
IN3 ", "
DELIMITED BY ' '
INTO OUT
and got
"701 STREET DR,nEW yORK cITY,SOME" -> looks much better
the only problem now: if first fields are empty-> i would get
,,, ->leading "," - but it could be fixed by programming- need to check before STRING...

Thank you very much, Mr. Cics Guy and Mr. Dick Scherrer

Re: Concat String fileds delimiter spaces

PostPosted: Sat Mar 01, 2008 2:59 am
by dick scherrer
You're welcome - good luck :)

d