I'm reading a string from a dataset using substr like this :
line = ' How can I convert this 000456 to a char '
number = word(line,6) -> here I used the word function but the idea is the
same
then i need to convert this number to a numeric so i could preform
arithmetic action on it ( plus , minus )
I can i do this ?
--
best regards,
matan cohen
MF System Administrator.
----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX
---- Matan Cohen <matanc...@GMAIL.COM> schrieb:
/* rexx */
line = ' How can I convert this 000456 to a char '
number = word(line,6)
say number * 3
I got 1368...
Rob
In a message dated 10/28/2010 8:10:42 A.M. US Mountain Standard Time,
--------------------------------------------------
From: "Matan Cohen" <matanc...@GMAIL.COM>
Sent: Thursday, October 28, 2010 10:54 AM
To: <TSO-...@VM.MARIST.EDU>
Subject: [TSO-REXX] convert string to numeric
xyz=number+1
...xyz would then contain the character string '457'. Right?
---
Bob Bridges, rhb...@attglobal.net, cell 336 382-7313
work bob.b...@libertymutual.com, 317 581-6487
/* If you read the New Testament with an Old-Covenant heart, it will be just
Law to you. Likewise, if you read the Old Testament with a New-Covenant
heart, you will see Christ in all of it. -Rick Joyner, "The Apostolic
Ministry" */
-----Original Message-----
From: Mickey
Sent: Thursday, October 28, 2010 16:04
There is NO datatyping in Rexx. The contents of a variable at the time you
ask defines it. So, While MY_VAR may contain the value XXX, if I assignit a
value of 123, I can perform numeric operations on it.
--------------------------------------------------
From: "Matan Cohen" <matanc...@GMAIL.COM>
Sent: Thursday, October 28, 2010 10:54 AM
> I'm reading a string from a dataset using substr like this :
> line = ' How can I convert this 000456 to a char '
> number = word(line,6) -> here I used the word function but the idea is the
> same
>
> then i need to convert this number to a numeric so i could preform
> arithmetic action on it ( plus , minus )
----------------------------------------------------------------------
that's correct - the result is "numeric" but in fact still a string in
a numeric format - no datatyping means you never have to predefine
what can be stored in a variable, but certain operations will crash at
run-time if not possible using the current contents of the variables
I seem to remember a language (could it have been Mantis?) where any
string containing anything numeric could be used in a computation, the
language "stripped off" the non-numeric part so that "this is 1" +
"that is 2" gave the answer 3!
Mickey
--------------------------------------------------
From: "Bob Bridges" <rhb...@ATTGLOBAL.NET>
Sent: Thursday, October 28, 2010 11:23 PM
To: <TSO-...@VM.MARIST.EDU>
Subject: Re: [TSO-REXX] convert string to numeric