Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Placing a varibale in a particular position using REXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
malathy_tv

New User


Joined: 29 May 2007
Posts: 34
Location: chennai

PostPosted: Tue May 13, 2008 5:07 pm    Post subject: Placing a varibale in a particular position using REXX
Reply with quote

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
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Tue May 13, 2008 5:18 pm    Post subject: Reply to: Placing a varibale in a particular position using
Reply with quote

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
View user's profile Send private message
Pedro

Senior Member


Joined: 01 Sep 2006
Posts: 2025
Location: Silicon Valley

PostPosted: Tue May 13, 2008 10:14 pm    Post subject: Reply to: Placing a varibale in a particular position using
Reply with quote

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
View user's profile Send private message
malathy_tv

New User


Joined: 29 May 2007
Posts: 34
Location: chennai

PostPosted: Wed May 14, 2008 10:04 am    Post subject:
Reply with quote

Hi all,

Thank you so much for the help... and its working great.....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm
No new posts REXX DB2: Dynamic allocation of DB2.D... BHAS CLIST & REXX 3 Mon Dec 19, 2016 8:26 pm
No new posts find particular member name in PDS us... ravi243 CLIST & REXX 10 Mon Dec 19, 2016 6:44 pm
No new posts What is the command to check MODE of ... rohanthengal CLIST & REXX 7 Fri Nov 18, 2016 1:48 pm
This topic is locked: you cannot edit posts or make replies. Rexx to create GDG by scanning JJ result krish.deepu CLIST & REXX 5 Tue Oct 25, 2016 5:32 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us