Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Variables/REXX/variables-1.rexx
Normal file
10
Task/Variables/REXX/variables-1.rexx
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
aa = 10 /*assigns chars 10 ───► AA */
|
||||
bb = '' /*assigns a null value ───► BB */
|
||||
cc = 2*10 /*assigns chars 20 ───► CC */
|
||||
dd = 'Adam' /*assigns chars Adam ───► DD */
|
||||
ee = "Adam" /*same as above ───► EE */
|
||||
ff = 10. /*assigns chars 10. ───► FF */
|
||||
gg = '10.' /*same as above ───► GG */
|
||||
hh = "+10" /*assigns chars +10 ───► hh */
|
||||
ii = 1e1 /*assigns chars 1e1 ───► ii */
|
||||
jj = +.1e+2 /*assigns chars .1e+2 ───► jj */
|
||||
18
Task/Variables/REXX/variables-2.rexx
Normal file
18
Task/Variables/REXX/variables-2.rexx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
kk = '123'x /*assigns hex 00000123 ───► KK */
|
||||
kk = 'dead beaf'X /*assigns hex deadbeaf ───► KK */
|
||||
ll = '0000 0010'b /*assigns blank ───► LL (ASCII) */
|
||||
mm = '0000 0100'B /*assigns blank ───► MM (EBCDIC)*/
|
||||
|
||||
xxx = '11 2. 333 -5'
|
||||
parse var xxx nn oo pp qq rr
|
||||
/*assigns 11 ───► NN */
|
||||
/*assigns 2. ───► OO */
|
||||
/*assigns 333 ───► PP */
|
||||
/*assigns ─5 ───► QQ */
|
||||
/*assigns "null" ───► RR */
|
||||
|
||||
/*a "null" is a string of length zero (0), */
|
||||
/*and is not to be confused with a null char.*/
|
||||
|
||||
cat = 'A cat is a lion in a jungle of small bushes.'
|
||||
/*assigns a literal ───► CAT */
|
||||
8
Task/Variables/REXX/variables-3.rexx
Normal file
8
Task/Variables/REXX/variables-3.rexx
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
call value 'CAT', "When the cat's away, the mice will play."
|
||||
/*assigns a literal ───► CAT */
|
||||
yyy='CA'
|
||||
call value yyy'T', "Honest as the Cat when the meat's out of reach."
|
||||
/*assigns a literal ───► CAT */
|
||||
yyy = 'CA'
|
||||
call value yyy || 'T', "Honest as the Cat when the meat's out of reach."
|
||||
/*assigns a literal ───► CAT */
|
||||
20
Task/Variables/REXX/variables-4.rexx
Normal file
20
Task/Variables/REXX/variables-4.rexx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/*REXX pgm to do a "bad" assignment (with an unassigned REXX variable).*/
|
||||
|
||||
signal on noValue /*usually, placed at pgm start. */
|
||||
|
||||
xxx=aaaaa /*tries to assign aaaaa ───► xxx */
|
||||
|
||||
say xxx 'or somesuch'
|
||||
exit
|
||||
|
||||
noValue: /*this can be dressed up better. */
|
||||
badLine =sigl /*REXX line number that failed. */
|
||||
badSource=sourceline(badLine) /*REXX source line ··· */
|
||||
badVar =condition('D') /*REXX var name that's ¬ defined.*/
|
||||
say
|
||||
say '*** error! ***'
|
||||
say 'undefined variable' badvar "at REXX line number" badLine
|
||||
say
|
||||
say badSource
|
||||
say
|
||||
exit 13
|
||||
18
Task/Variables/REXX/variables-5.rexx
Normal file
18
Task/Variables/REXX/variables-5.rexx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*REXX pgm shows different scopes of a variable: "global" and "local".*/
|
||||
q = 55 ; say ' 1st q=' q /*assign a value ───► "main" Q.*/
|
||||
call sub ; say ' 2nd q=' q /*call a procedure subroutine. */
|
||||
call gyro ; say ' 3rd q=' q /*call a procedure with EXPOSE. */
|
||||
call sand ; say ' 4th q=' q /*call a subroutine or function. */
|
||||
exit /*stick a fork in it, we're done.*/
|
||||
/*──────────────────────────────────SUB subroutine──────────────────────*/
|
||||
sub: procedure /*use PROCEDURE to use local vars*/
|
||||
q = -777 ; say ' sub q=' q /*assign a value ───► "local" Q. */
|
||||
return
|
||||
/*──────────────────────────────────GYRO subroutine─────────────────────*/
|
||||
gyro: procedure expose q /*use EXPOSE to use global var Q.*/
|
||||
q = "yuppers" ; say 'gyro q=' q /*assign a value ───► "exposed" Q*/
|
||||
return
|
||||
/*──────────────────────────────────SAND subroutine─────────────────────*/
|
||||
sand: /*all REXX variables are exposed.*/
|
||||
q = "Monty" ; say 'sand q=' q /*assign a value ───► "global" Q*/
|
||||
return
|
||||
7
Task/Variables/REXX/variables-6.rexx
Normal file
7
Task/Variables/REXX/variables-6.rexx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
aaa. = '───────nope.' /*assign this string as a default*/
|
||||
aaa.1=1 /*assign 1 to first element.*/
|
||||
aaa.4=4. /* " 4 " fourth " */
|
||||
aaa.7='lucky' /* " 7 " seventh " */
|
||||
do j=0 to 8 /*go through a bunch of elements.*/
|
||||
say 'aaa.'||j '=' aaa.j /*display element # and its value*/
|
||||
end /*we could've started J at -100.*/
|
||||
4
Task/Variables/REXX/variables-7.rexx
Normal file
4
Task/Variables/REXX/variables-7.rexx
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
radius=6.28 /*assign a value to a variable. */
|
||||
say 'radius =' radius
|
||||
drop radius /*now, "undefine" the variable. */
|
||||
say 'radius =' radius
|
||||
7
Task/Variables/REXX/variables-8.rexx
Normal file
7
Task/Variables/REXX/variables-8.rexx
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
var.='something' /* sets all possible compound variables of stem var. */
|
||||
x='3 '
|
||||
var.x.x.4='something else'
|
||||
Do i=1 To 5
|
||||
a=left(i,2)
|
||||
Say i var.a.a.4 "(tail is '"a||'.'||a||'.'||'4'"')"
|
||||
End
|
||||
Loading…
Add table
Add a link
Reference in a new issue