Data update
This commit is contained in:
parent
4d5544505c
commit
4924dd0264
3073 changed files with 55820 additions and 4408 deletions
|
|
@ -1,58 +1,72 @@
|
|||
/*REXX program demonstrates how to set and display values for an associative array. */
|
||||
/*╔════════════════════════════════════════════════════════════════════════════════════╗
|
||||
║ The (below) two REXX statements aren't really necessary, but it shows how to ║
|
||||
║ define any and all entries in a associative array so that if a "key" is used that ║
|
||||
║ isn't defined, it can be displayed to indicate such, or its value can be checked ║
|
||||
║ to determine if a particular associative array element has been set (defined). ║
|
||||
╚════════════════════════════════════════════════════════════════════════════════════╝*/
|
||||
stateF.= ' [not defined yet] ' /*sets any/all state former capitals.*/
|
||||
stateN.= ' [not defined yet] ' /*sets any/all state names. */
|
||||
w = 0 /*the maximum length of a state name.*/
|
||||
stateL =
|
||||
/*╔════════════════════════════════════════════════════════════════════════════════════╗
|
||||
║ The list of states (empty as of now). It's convenient to have them in alphabetic ║
|
||||
║ order; they'll be listed in the order as they are in the REXX program below). ║
|
||||
║ In REXX, when a key is used (for a stemmed array, as they are called in REXX), ║
|
||||
║ and the key isn't assigned a value, the key's name is stored (internally) as ║
|
||||
║ uppercase (Latin) characters (as in the examples below. If the key has a ║
|
||||
║ a value, the key's value is used as is (i.e.: no upper translation is performed).║
|
||||
║ Actually, any characters can be used, including blank(s) and non─displayable ║
|
||||
║ characters (including '00'x, 'ff'x, commas, periods, quotes, ···). ║
|
||||
╚════════════════════════════════════════════════════════════════════════════════════╝*/
|
||||
call setSC 'al', "Alabama" , 'Tuscaloosa'
|
||||
call setSC 'ca', "California" , 'Benicia'
|
||||
call setSC 'co', "Colorado" , 'Denver City'
|
||||
call setSC 'ct', "Connecticut" , 'Hartford and New Haven (jointly)'
|
||||
call setSC 'de', "Delaware" , 'New-Castle'
|
||||
call setSC 'ga', "Georgia" , 'Milledgeville'
|
||||
call setSC 'il', "Illinois" , 'Vandalia'
|
||||
call setSC 'in', "Indiana" , 'Corydon'
|
||||
call setSC 'ia', "Iowa" , 'Iowa City'
|
||||
call setSC 'la', "Louisiana" , 'New Orleans'
|
||||
call setSC 'me', "Maine" , 'Portland'
|
||||
call setSC 'mi', "Michigan" , 'Detroit'
|
||||
call setSC 'ms', "Mississippi" , 'Natchez'
|
||||
call setSC 'mo', "Missouri" , 'Saint Charles'
|
||||
call setSC 'mt', "Montana" , 'Virginia City'
|
||||
call setSC 'ne', "Nebraska" , 'Lancaster'
|
||||
call setSC 'nh', "New Hampshire" , 'Exeter'
|
||||
call setSC 'ny', "New York" , 'New York'
|
||||
call setSC 'nc', "North Carolina" , 'Fayetteville'
|
||||
call setSC 'oh', "Ohio" , 'Chillicothe'
|
||||
call setSC 'ok', "Oklahoma" , 'Guthrie'
|
||||
call setSC 'pa', "Pennsylvania" , 'Lancaster'
|
||||
call setSC 'sc', "South Carolina" , 'Charlestown'
|
||||
call setSC 'tn', "Tennessee" , 'Murfreesboro'
|
||||
call setSC 'vt', "Vermont" , 'Windsor'
|
||||
-- 8 Aug 2025
|
||||
include Settings
|
||||
|
||||
do j=1 for words(stateL) /*show all capitals that were defined. */
|
||||
$= word(stateL, j) /*get the next (USA) state in the list.*/
|
||||
say 'the former capital of ('$") " left(stateN.$, w) " was " stateC.$
|
||||
end /*j*/ /* [↑] show states that were defined.*/
|
||||
exit /*stick a fork in it, we're all done. */
|
||||
/*──────────────────────────────────────────────────────────────────────────────────────*/
|
||||
setSC: parse arg code,name,cap; upper code /*get code, name & cap.; uppercase code*/
|
||||
stateL= stateL code /*keep a list of all the US state codes*/
|
||||
stateN.code= name; w= max(w,length(name)) /*define the state's name; max width. */
|
||||
stateC.code= cap /* " " " code to the capital*/
|
||||
return /*return to invoker, SETSC is finished.*/
|
||||
say 'ASSOCIATIVE ARRAY: ITERATION'
|
||||
say version
|
||||
say
|
||||
list=''; arra.=''; w=0
|
||||
-- States with former capitals: key, name, capital
|
||||
call SetStateCap 'al','Alabama','Tuscaloosa'
|
||||
call SetStateCap 'ca','California','Benicia'
|
||||
call SetStateCap 'co','Colorado','Denver City'
|
||||
call SetStateCap 'ct','Connecticut','Hartford and New Haven'
|
||||
call SetStateCap 'de','Delaware','New-Castle'
|
||||
call SetStateCap 'ga','Georgia','Milledgeville'
|
||||
call SetStateCap 'il','Illinois','Vandalia'
|
||||
call SetStateCap 'in','Indiana','Corydon'
|
||||
call SetStateCap 'ia','Iowa','Iowa City'
|
||||
call SetStateCap 'la','Louisiana','New Orleans'
|
||||
call SetStateCap 'me','Maine','Portland'
|
||||
call SetStateCap 'mi','Michigan','Detroit'
|
||||
call SetStateCap 'ms','Mississippi','Natchez'
|
||||
call SetStateCap 'mo','Missouri','Saint Charles'
|
||||
call SetStateCap 'mt','Montana','Virginia City'
|
||||
call SetStateCap 'ne','Nebraska','Lancaster'
|
||||
call SetStateCap 'nh','New Hampshire','Exeter'
|
||||
call SetStateCap 'ny','New York','New York'
|
||||
call SetStateCap 'nc','North Carolina','Fayetteville'
|
||||
call SetStateCap 'oh','Ohio','Chillicothe'
|
||||
call SetStateCap 'ok','Oklahoma','Guthrie'
|
||||
call SetStateCap 'pa','Pennsylvania','Lancaster'
|
||||
call SetStateCap 'sc','South Carolina','Charlestown'
|
||||
call SetStateCap 'tn','Tennessee','Murfreesboro'
|
||||
call SetStateCap 'vt','Vermont','Windsor'
|
||||
arra.0=w
|
||||
-- Loop through list
|
||||
say 'Using a list...'
|
||||
do w = 1 to words(list)
|
||||
a=Word(list,w)
|
||||
say 'The former capital of' stna.a '('a')' 'was' stca.a
|
||||
end
|
||||
say
|
||||
-- Loop through aux array...'
|
||||
say 'Using an array...'
|
||||
do w = 1 to arra.0
|
||||
a=arra.w
|
||||
say 'The former capital of' stna.a '('a')' 'was' stca.a
|
||||
end
|
||||
say
|
||||
-- Show all vars
|
||||
say 'Variables...'
|
||||
if pos('Regina',version) > 0 then
|
||||
call Library
|
||||
call SysDumpVariables
|
||||
exit
|
||||
|
||||
SetStateCap:
|
||||
parse arg code,name,cap
|
||||
code=Upper(code)
|
||||
-- Next row in associative array
|
||||
stna.code=name; stca.code=cap
|
||||
-- Track keys in a list
|
||||
list=list code
|
||||
-- Track keys in an array
|
||||
w=w+1; arra.w=code
|
||||
return
|
||||
|
||||
Library:
|
||||
call RxFuncAdd 'SysLoadFuncs','RegUtil','SysLoadFuncs'
|
||||
call SysLoadFuncs
|
||||
return
|
||||
|
||||
include Abend
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue