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
 

 

How to split a variable values?

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

New User


Joined: 03 Nov 2008
Posts: 42
Location: Pune

PostPosted: Mon Mar 23, 2009 2:20 pm    Post subject: How to split a variable values?
Reply with quote

Hi

I Have a variable with value '2020010902056100118A51A5100'
how can i split this value in following format using rexx.
a=2020
b=001
c=090205
d=61
e=00118
f=A51
g=A51
h=00

Please sugesst.
Back to top
View user's profile Send private message

ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2360
Location: Israel

PostPosted: Mon Mar 23, 2009 2:33 pm    Post subject:
Reply with quote

What is the logic behind your split? Is it location-dependent? Value-dependent?

O.
Back to top
View user's profile Send private message
mpawan
Warnings : 2

New User


Joined: 03 Nov 2008
Posts: 42
Location: Pune

PostPosted: Mon Mar 23, 2009 2:41 pm    Post subject:
Reply with quote

This is an alpha numeric value, it can be a complete numeric values.
when it is a completely numeric value the split can be done simply dividing the data by 1000.... but some times the value comes in alpha numeric then my logic wont work instead an error is thrown.

And the length of the data is constant. I need a logic how to split the alpha numeric data into several variables. Like variable "a" has first four numbers of the data then variable "b" has next 3 data like wise.
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10211
Location: italy

PostPosted: Mon Mar 23, 2009 2:46 pm    Post subject: Reply to: How to split a variable values?
Reply with quote

Code:
v = "2020010902056100118A51A5100"
/*   12345678901234567890123456789
parse var v a 5 b 7 c 13 d 15 e 20 f 23 g 26 h

say "a=" a
say "b=" b
say "c=" c
say "d=" d
say "e=" e
say "f=" f
say "g=" g
say "h=" h
Back to top
View user's profile Send private message
mpawan
Warnings : 2

New User


Joined: 03 Nov 2008
Posts: 42
Location: Pune

PostPosted: Mon Mar 23, 2009 2:47 pm    Post subject:
Reply with quote

Thanks Enrico
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
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am
No new posts Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts how to split records based on specifi... Venkata Ramayya DFSORT/ICETOOL 6 Wed Sep 28, 2016 3:20 am


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