IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

REXX - Validating the digits of a variable

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> CLIST & REXX
View previous topic :: View next topic  
Author Message
sridevi_g



Joined: 15 Nov 2005
Posts: 4

Posted: Tue Nov 15, 2005 3:35 pm    Post subject: REXX - Validating the digits of a variable  

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



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

Posted: Tue Nov 15, 2005 6:34 pm    Post subject:  

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 :D
Back to top  
rexxhead



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

Posted: Tue Nov 15, 2005 6:39 pm    Post subject:  

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

it's not all digits.
Back to top  
sridevi_g



Joined: 15 Nov 2005
Posts: 4

Posted: Wed Nov 16, 2005 3:12 pm    Post subject: REXX - Validating the digits of a variable  

Thanks Paddy. It works.
Back to top  
mainframesguru



Joined: 24 Jun 2005
Posts: 38
Location: Hyderabad

Posted: Thu Nov 17, 2005 10:56 am    Post subject: Re: REXX - Validating the digits of a variable  

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



Joined: 15 Nov 2005
Posts: 4

Posted: Thu Nov 17, 2005 2:48 pm    Post subject: REXX - Validating the digits of a variable  

Hi Paddy,

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

Regards,
Sri
Back to top  
Paddy



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

Posted: Thu Nov 17, 2005 3:14 pm    Post subject: Re: REXX - Validating the digits of a variable  

Hi Sri,

SUBSTR function works equally with character or numeric variables.


Regards
Paddy :)
Back to top  
mak_tcs



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

Posted: Wed Nov 23, 2005 8:01 pm    Post subject:  

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  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> CLIST & REXX
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM