|
|
| Author |
Message |
malathy_tv
New User
Joined: 29 May 2007 Posts: 24 Location: chennai
|
|
|
|
Hi,
can any one please let me know if there is any way of placing a varibale in the position specified using REXX
EX:
Input File delimited by comma
----+----1----+----2----+--
AAA,BBB,CCC
EEE,FFFFFFF,GGGGG
HHH,IIIIIIIIII,JJ
Required the output file like
first varibale in position 10 irrespective of length,
second in position 20 and third in position 40
1----+----2----+----3----+----4----+----5-
AAA BBB CCC
EEE FFFFFFF GGGGG
HHH IIIIIIIIII JJ |
|
| Back to top |
|
 |
References
|
Posted: Tue May 13, 2008 5:07 pm Post subject: Re: Placing a varibale in a particular position using REXX |
 |
|
|
 |
enrico-sorichetti
Global Moderator
Joined: 14 Mar 2007 Posts: 2560 Location: italy
|
|
|
|
| Code: |
csv="AAA,bbb,ccccc,d,e,f"
parse var csv v1 "," v2 "," v3 "," v4 "," v5 "," v6 "," .
txt = ""
txt = txt || left(v1,10," ")
txt = txt || left(v2,10," ")
txt = txt || left(v3,10," ")
txt = txt || left(v4,10," ")
txt = txt || left(v5,10," ")
txt = txt || left(v6,10," ")
say "csv ==>" csv
say "txt ==>" txt
|
tested and working |
|
| Back to top |
|
 |
Moved: Tue May 13, 2008 5:39 pm by enrico-sorichetti From IMS DB/DC to CLIST & REXX |
Pedro
Senior Member
Joined: 01 Sep 2006 Posts: 313 Location: work
|
|
|
|
Enrico's solution looks good, except the OP wanted the first value to be in position 10.
I think initial value of txt should be:
| Code: |
txt = copies(" ",9)
|
which will cause everything else to shift right |
|
| Back to top |
|
 |
malathy_tv
New User
Joined: 29 May 2007 Posts: 24 Location: chennai
|
|
|
|
Hi all,
Thank you so much for the help... and its working great..... |
|
| Back to top |
|
 |
|
|
|