Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Rexx Ask Command

/* Main program */ 
input = ask 
say input

Rexx Interpret

/* Main program */ 
options arexx_bifs interpret 
say 'Hello'

Rexx Drop

/* Main program */ 
options arexx_bifs 
a = 5 
say a 
drop a 
say a 

Rexx Inheritance

/* Main program */ 
st = .student~new 
st~StudentID = 1 
st~StudentName = 'Joe' 
st~Marks1 = 10 
st~Marks2 = 20 
st~Marks3 = 30 
say st~Total(st~Marks1,st~Marks2,st~Marks3)  

exit 0 
::class Person 
::class student subclass Person 
::attribute StudentID 
::attribute StudentName 
::attribute Marks1 
::attribute Marks2 
::attribute Marks3 
::method 'Total' 
use arg a,b,c 
return (ABS(a) + ABS(b) + ABS(c))

Rexx Creating Multiple Objects

/* Main program */ 
st = .student~new 
st~StudentID = 1 
st~StudentName = 'Joe' 
st~Marks1 = 10 
st~Marks2 = 20 
st~Marks3 = 30 
total = st~Total(st~Marks1,st~Marks2,st~Marks3) 
say total  

st1  =  .student~new 
st1~StudentID = 2 
st1~StudentName = 'John' 
st1~Marks1 = 10 
st1~Marks2 = 20 
st1~Marks3 = 40 
total = st1~Total(st1~Marks1,st1~Marks2,st1~Marks3) 
say total  

st2  =  .student~new 
st2~StudentID = 3 
st2~StudentName = 'Mark' 
st2~Marks1 = 10 
st2~Marks2 = 20 
st2~Marks3 = 30 
total = st2~Total(st2~Marks1,st2~Marks2,st2~Marks3) 
say total  

exit 0 
::class student 
::attribute StudentID 
::attribute StudentName 
::attribute Marks1 
::attribute Marks2 
::attribute Marks3 
::method 'Total' 
use arg a,b,c 
return (ABS(a) + ABS(b) + ABS(c)) 

Rexx Instance Method

/* Main program */ 
value = .student~new 
value~StudentID = 1 
value~StudentName = 'Joe' 
value~Marks1 = 10 
value~Marks2 = 20 
value~Marks3 = 30 
total = value~Total(value~Marks1,value~Marks2,value~Marks3) 
say total 

exit 0 
::class student 
::attribute StudentID 
::attribute StudentName 
::attribute Marks1 
::attribute Marks2 
::attribute Marks3 
::method 'Total' 
use arg a,b,c 
return (ABS(a) + ABS(b) + ABS(c)) 

Rexx getter setter method

/* Main program */ 
value = .student~new 
value~StudentID = 1 
value~StudentName = 'Joe' 
say value~StudentID 
say value~StudentName 

exit 0 
::class student 
::attribute StudentID 
::attribute StudentName

Rexx Interactive Tracing

/* Main program */ 
trace ?A

/* Main program */ 
n = 100.45 if datatype( n, wholenumber ) then 
signal msg 

say 'This is a whole number' 
return 0 
msg : say 'This is an incorrect number'

Rexx Trace Function

/* Main program */ 
say trace() 

/* Main program */ 
n = 100.45 if datatype( n, wholenumber ) then signal msg 

say 'This is a whole number' 
return 0 
msg : 

say 'This is an incorrect number ' 

Rexx Trace in Batch Mode

/* Main program */ 
trace A 

/* Main program */ 
n = 100.45 if datatype( n, wholenumber ) then signal msg 

say 'This is a whole number' 
return 0 

msg : 
   say ' This is an incorrect number ' 

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.