Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,11 @@
|
|||
call routineName /*no arguments passed to routine.*/
|
||||
call routineName 50 /*one argument (fifty) passed. */
|
||||
call routineName 50,60 /*two arguments passed. */
|
||||
call routineName 50, 60 /*(same as above) */
|
||||
call routineName 50 ,60 /*(same as above) */
|
||||
call routineName 10*5 , 8**4 - 4 /*(same as above) */
|
||||
call routineName 50 , , , 70 /*4 args passed, 2nd&3rd omitted.*/
|
||||
/*omitted args are NOT null. */
|
||||
call routineName ,,,,,,,,,,,,,,,,800 /*17 args passed, 16 omitted. */
|
||||
call date /*looks for DATE internally first*/
|
||||
call 'DATE' /* " " " BIF | externally*/
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
...
|
||||
prod=1
|
||||
a=7 /*or somesuch.*/
|
||||
b=3 /* likewise. */
|
||||
|
||||
op='**' /*or whatever.*/
|
||||
...
|
||||
select
|
||||
when op=='+' then r=a+b /*add. */
|
||||
when op=='-' then r=a-b /*subtract. */
|
||||
when op=='∙' then do; r=a*b; prod=prod*r; end /*multiply.*/
|
||||
when op=='*' then r=a*b /*multiply. */
|
||||
when op=='**' then r=a**b /*power (exponentiation) */
|
||||
when op=='/' & b\=0 then r=a/b /*divide. */
|
||||
when op=='%' & b\=0 then r=a/b /*interger divide. */
|
||||
when op=='//' & b\=0 then r=a/b /*modulus (remainder). */
|
||||
when op=='||' then r=a||b /*concatenation. */
|
||||
when op=='caw' then r=xyz(a,b) /*call the XYZ subroutine*/
|
||||
otherwise r='[n/a]' /*signify not applicable.*/
|
||||
end /*select*/
|
||||
|
||||
say 'result for' a op b "=" r
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
...
|
||||
signal on error
|
||||
signal on failure
|
||||
signal on halt
|
||||
signal on lostdigits /*newer REXXes.*/
|
||||
signal on notready
|
||||
signal on novalue
|
||||
signal on syntax
|
||||
|
||||
signal off error
|
||||
signal off failure
|
||||
signal off halt
|
||||
signal off lostdigits /*newer REXXes.*/
|
||||
signal off notready
|
||||
signal off novalue
|
||||
signal off syntax
|
||||
...
|
||||
signal on novalue
|
||||
...
|
||||
x=oopsay+1 /* ◄─── this is it.*/
|
||||
exit
|
||||
|
||||
novalue: say
|
||||
say '───────────────────────────error!─────────────────────────────────'
|
||||
say 'that reference to oopsay (above) will cause control to get here.'
|
||||
parse source . . fid .
|
||||
say; say 'REXX raised a NOVALUE error in program:' fid
|
||||
say; say 'it occurred on line' sigl
|
||||
say; say 'the REXX statement is:' /*put it on separate line.*/
|
||||
say sourceline(sigl)
|
||||
say; say 'which code:' condition('C') "error"
|
||||
say; say 'REXX variable:' condition('D')
|
||||
say; say "Moral: shouldn't do that."
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
numeric digits 1000 /*prepare for some gihugeic numbers.*/
|
||||
...
|
||||
n=4
|
||||
call factorial n
|
||||
say n'!=' result
|
||||
exit
|
||||
/*──────────────────────────────────FACTORIAL subroutine────────────────*/
|
||||
factorial: parse arg x
|
||||
!=1
|
||||
do j=2 to x
|
||||
!=!*j
|
||||
end /*j*/
|
||||
return !
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
exit
|
||||
|
||||
exit expression
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
numeric digits 1000 /*prepare for some gihugeic numbers.*/
|
||||
...
|
||||
n=4
|
||||
say n'!=' factorial(n)
|
||||
exit
|
||||
/*──────────────────────────────────FACTORIAL subroutine────────────────*/
|
||||
factorial: parse arg x
|
||||
!=1
|
||||
do j=2 to x
|
||||
!=!*j
|
||||
end /*j*/
|
||||
return !
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
sum=0
|
||||
do j=1 to 1000
|
||||
if j//3==0 | j//7==0 then iterate
|
||||
sum=sum+j
|
||||
end /*j*/
|
||||
|
||||
/*shows sum of 1k numbers except those divisible by 3 or 7.*/
|
||||
say 'sum='sum
|
||||
...
|
||||
numeric digits 5000
|
||||
prod=0
|
||||
do k=1 to 2000
|
||||
do m=1 to k
|
||||
if m>99 then iterate k
|
||||
prod=prod*m
|
||||
end /*m*/
|
||||
end /*k*/
|
||||
say 'prod=' prod
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
do j=1 to 10
|
||||
say 'j=' j
|
||||
if j>5 then leave
|
||||
say 'negative j=' (-j)
|
||||
end /*j*/
|
||||
|
||||
say 'end of the DO loop for j.'
|
||||
|
||||
ouch=60
|
||||
sum=0
|
||||
do k=0 to 100 by 3
|
||||
say 'k=' k
|
||||
do m=1 to k
|
||||
if m=ouch then leave k
|
||||
sum=sum+m
|
||||
end /*m*/
|
||||
end /*k*/
|
||||
say 'sum=' sum
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
...
|
||||
signal on syntax
|
||||
...
|
||||
y=4 - 4
|
||||
x=66
|
||||
say x/y /*divide x by y.*/
|
||||
say "yup, that's a divide by zero, by gum."
|
||||
exit
|
||||
|
||||
syntax: say
|
||||
|
||||
/* We can now possibly do some repair work , but most people trap */
|
||||
/* the condition, display where it happened, the REXX sourceline */
|
||||
/* (the actual REXX statement), which condition was triggered, */
|
||||
/* display any other pertinent REXX variables, which line in the */
|
||||
/* REXX program, and then (usually) exit with some kind of error */
|
||||
/* message and error code indicator. */
|
||||
/* Note: the "name" of the REXX program isn't quite accurate, */
|
||||
/* rather, it is the name that was invoked (called by), which may */
|
||||
/* be different name than the actual program being executed. */
|
||||
|
||||
say '──────────────────────error!─────────────────────────'
|
||||
say 'that division (above) will cause control to get here.'
|
||||
parse source . . fid .
|
||||
say; say 'REXX raised a SYNTAX error in program:' fid
|
||||
say; say 'it occurred on line' sigl
|
||||
say; say 'the REXX statement is:' /*put it on separate line.*/
|
||||
say sourceline(sigl)
|
||||
say; say 'which code:' condition('C') "error"
|
||||
say; say 'error code:' condition('D')
|
||||
say; say "Moral: don't do that."
|
||||
exit 13
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
Say 'Interrupt this program after a short while'
|
||||
Call on halt
|
||||
Do i=1 To 10000000
|
||||
j=i**2+1
|
||||
End
|
||||
halt: Say i j
|
||||
Return
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
return
|
||||
|
||||
return expression
|
||||
Loading…
Add table
Add a link
Reference in a new issue