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

REXX - Validating the digits of a variable


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
sridevi_g

New User


Joined: 15 Nov 2005
Posts: 3

PostPosted: Tue Nov 15, 2005 3:35 pm
Reply with quote

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
View user's profile Send private message
Paddy

New User


Joined: 12 Sep 2005
Posts: 46
Location: Paris France

PostPosted: Tue Nov 15, 2005 6:34 pm
Reply with quote

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 icon_biggrin.gif
Back to top
View user's profile Send private message
rexxhead

New User


Joined: 15 Nov 2005
Posts: 3
Location: Florida SunCoast

PostPosted: Tue Nov 15, 2005 6:39 pm
Reply with quote

Code:

if Verify(X,"0123456789") > 0 then ...

it's not all digits.
Back to top
View user's profile Send private message
sridevi_g

New User


Joined: 15 Nov 2005
Posts: 3

PostPosted: Wed Nov 16, 2005 3:12 pm
Reply with quote

Thanks Paddy. It works.
Back to top
View user's profile Send private message
mainframesguru

New User


Joined: 24 Jun 2005
Posts: 36
Location: Hyderabad

PostPosted: Thu Nov 17, 2005 10:56 am
Reply with quote

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
View user's profile Send private message
sridevi_g

New User


Joined: 15 Nov 2005
Posts: 3

PostPosted: Thu Nov 17, 2005 2:48 pm
Reply with quote

Hi Paddy,

I think SUBSTR works only for character variables, what is the command for numeric variables.

Regards,
Sri
Back to top
View user's profile Send private message
Paddy

New User


Joined: 12 Sep 2005
Posts: 46
Location: Paris France

PostPosted: Thu Nov 17, 2005 3:14 pm
Reply with quote

Hi Sri,

SUBSTR function works equally with character or numeric variables.


Regards
Paddy :)
Back to top
View user's profile Send private message
mak_tcs

New User


Joined: 23 Nov 2005
Posts: 69
Location: Minneapolis, MN USA

PostPosted: Wed Nov 23, 2005 8:01 pm
Reply with quote

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
View user's profile Send private message
Arun Kumar S

New User


Joined: 23 Jan 2009
Posts: 14
Location: Bangalore

PostPosted: Fri Jan 23, 2009 4:59 pm
Reply with quote

Hi Sri,

Yes the below statement will hold the length of the var.

Xlen= LENGTH(X) icon_cool.gif
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Fri Jan 23, 2009 5:09 pm
Reply with quote

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 icon_biggrin.gif
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 Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top