Anonymous user
Table creation/Postal addresses: Difference between revisions
m
→version 1: added/changed whitespace and comments, moved a boxed set of REXX program comments to it's own section.
m (Added the Sidef language) |
m (→version 1: added/changed whitespace and comments, moved a boxed set of REXX program comments to it's own section.) |
||
Line 801:
<br>In addition to "state", fields such as province, municipality, ward,
parish, country, etc) could be added without exclusion.
<lang>╔════════════════════════════════════════════════════════════════════════════════╗
╟───── Format of an entry in the USA address/city/state/zip code structure:──────╣
║ ║
║ The "structure" name can be any legal variable name, but here the name will be ║
║ shortened to make these comments (and program) easier to read; its name will ║
║ be @USA (in any letter case). In addition, the following variable names║
║ (stemmed array tails) will need to be kept uninitialized (that is, not used ║
║ for any variable name). To that end, each of these variable names will have an║
║ underscore in the beginning of each name. Other possibilities are to have a ║
║ trailing underscore (or both leading and trailing), or some other special eye─ ║
║ catching character such as: ! @ # $ ? ║
║ ║
║ Any field not specified will have a value of "null" (which has a length of 0).║
║
║ restrictions imposed by the standards or the USA legal definitions. ║
║ Any number of fields could be added (with invalid field testing). ║
╟────────────────────────────────────────────────────────────────────────────────╣
║
║ ║
║
╟────────────────────────────────────────────────────────────────────────────────╣
║ @USA.nnn._name is the name of person, business, or a lot description. ║
╟────────────────────────────────────────────────────────────────────────────────╣
║ @USA.nnn._addr is the 1st street address ║
║ @USA.nnn._addr3 is the 3rd street address ║
╟────────────────────────────────────────────────────────────────────────────────╣
╟────────────────────────────────────────────────────────────────────────────────╣
║ @USA.nnn._city is the official city name, it may include any character. ║
╟────────────────────────────────────────────────────────────────────────────────╣
║ @USA.nnn._zip is the USA postal zip code, five or ten digit format. ║
╟────────────────────────────────────────────────────────────────────────────────╣
║ @USA.nnn._upHist is the update history (who, date and timestamp). ║
╚════════════════════════════════════════════════════════════════════════════════╝</lang>
<lang rexx>/*REXX program creates, builds, and lists a table of U.S.A. postal addresses.*/
@usa.=; @usa.0=0 /*initialize stemmed array & 1st value.*/
@usa.0=@usa.0+1 /*bump the unique number for usage. */
call USA '_city' , 'Boston'
call USA '_state' , 'MA'
call USA '_addr' , "51 Franklin Street"
call USA '_name' , "FSF Inc."
call
@usa.0=@usa.0+1 /*bump the unique number for usage. */
call
call
call
call USA '_addr2' , "1600 Pennsylvania Avenue NW"
call USA '_name' , "The White House"
call
call
exit /*stick a fork in it, we're all done. */
/*────────────────────────────────────────────────────────────────────────────*/
USA: procedure expose @USA.; parse arg what,txt; arg ?; nn=@usa.0
if ?=='LIST' then do nn=1 for @usa.0; call lister; end /*nn*/
else do
call value '@USA.'nn".upHist", userid() date() time()
end
return
/*────────────────────────────────────────────────────────────────────────────*/
/*────────────────────────────────────────────────────────────────────────────*/
call tell '_state'
say
'''output''' (data used is within the REXX program):
<pre>
name ──► FSF Inc.
addr ──► 51 Franklin Street
|