IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to split a variable values?


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
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
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: 2358
Location: Israel

PostPosted: Mon Mar 23, 2009 2:33 pm
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
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Mon Mar 23, 2009 2:46 pm
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
Search our Forums:

Back to Top