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: 10231
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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Writing on to GSAM variable length rohanthengal JCL & VSAM 6 Fri Mar 03, 2017 7:46 pm
No new posts Replacing same string with different ... vickey_dw DFSORT/ICETOOL 6 Wed Feb 22, 2017 10:44 pm
No new posts setting new limit Key values for inde... srilata83 DB2 1 Fri Feb 10, 2017 9:24 pm


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