View previous topic :: View next topic
|
Author |
Message |
sridevi_g
New User
Joined: 15 Nov 2005 Posts: 3
|
|
|
|
Hi,
Is there any REXX command to do the following:
Assume X is 5 digits long, i need to validate whether all the 5 digits are populated or not.
I know, sometimes a single command will not be sufficient to do the above functionality,so, can you please let me know the command to retrieve individual digits of a variable.
Regards,
Sri |
|
Back to top |
|
|
Paddy
New User
Joined: 12 Sep 2005 Posts: 46 Location: Paris France
|
|
|
|
Hi Sri,
You can try this function :
SUBSTR(X,n,length) with n = 1 for the first digit and length = 1 for one digit.
Regards
Paddy |
|
Back to top |
|
|
rexxhead
New User
Joined: 15 Nov 2005 Posts: 3 Location: Florida SunCoast
|
|
|
|
Code: |
if Verify(X,"0123456789") > 0 then ...
|
it's not all digits. |
|
Back to top |
|
|
sridevi_g
New User
Joined: 15 Nov 2005 Posts: 3
|
|
|
|
Thanks Paddy. It works. |
|
Back to top |
|
|
mainframesguru
New User
Joined: 24 Jun 2005 Posts: 36 Location: Hyderabad
|
|
|
|
HI all,
As its said that, X is a numeric item, then just use simple following logic:
If X > 10000 AND X < 99999 THEN
do
SOME LOGIC
end
ELSE
do
SOME OTHER LOGIC
end
Thanks,
Vamshi Krishna Indla |
|
Back to top |
|
|
sridevi_g
New User
Joined: 15 Nov 2005 Posts: 3
|
|
|
|
Hi Paddy,
I think SUBSTR works only for character variables, what is the command for numeric variables.
Regards,
Sri |
|
Back to top |
|
|
Paddy
New User
Joined: 12 Sep 2005 Posts: 46 Location: Paris France
|
|
|
|
Hi Sri,
SUBSTR function works equally with character or numeric variables.
Regards
Paddy :) |
|
Back to top |
|
|
mak_tcs
New User
Joined: 23 Nov 2005 Posts: 69 Location: Minneapolis, MN USA
|
|
|
|
Hi Sri,
I dont know whether my understanding of ur query is correct.
I assume X is a string not an array.
U can check the string by using the following function
xlen= LENGTH(X)
xlen will hold value 5 if the string X is populated with 5 digits.
Please let me know if can help u in better way
Thanks,
Mani |
|
Back to top |
|
|
Arun Kumar S
New User
Joined: 23 Jan 2009 Posts: 14 Location: Bangalore
|
|
|
|
Hi Sri,
Yes the below statement will hold the length of the var.
Xlen= LENGTH(X) |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
Arun,
you replied to a post more than three years old,
maybe Sri has solved his problem already,
he would be in big trouble if he hadn' t by now |
|
Back to top |
|
|
|