Anonymous user
Table creation/Postal addresses: Difference between revisions
m
→version 1: changed the wording in the boxed comments, added/changed comments and whitespace, changed indentations of the output, simplified the specification for addresses, used a template for the output.
Thundergnat (talk | contribs) (→{{header|Perl 6}}: Add a Perl 6 example) |
m (→version 1: changed the wording in the boxed comments, added/changed comments and whitespace, changed indentations of the output, simplified the specification for addresses, used a template for the output.) |
||
Line 885:
===version 1===
A REXX program can call SQL or any other database system, but the version shown here is a RYO (roll your own).
<br>The fields are for the most part, USA specific, but could be expanded▼
<br>In addition to "state", fields such as province, municipality, ward,▼
▲
<br>A logging facility is included which tracks who (by userID) did what update (or change), along with a timestamp. ▼
▲
<pre>
╔════════╤════════════════════════════════════════════════════════════════════════╤══════╗
║ ║
║ The
║
║ ║▼
║ Each of the variable names beginning with an underscore (_) aren't to be used elsewhere║
║
║ some other special eye─catching character such as: ! @ # $ ? ║
║ Any field not specified will have a value of a null (which has a length of zero). ║
▲║ catching character such as: ! @ # $ ? ║
║ ║
║ Any field
║ restrictions imposed by the standards or the USA legal
║ Any
╟────────────────────────────────────────────────────────────────────────────────────────╢
║
║
╟────────────────────────────────────────────────────────────────────────────────────────╢
▲║ ║
║ @USA.nnn._name
╟────────────────────────────────────────────────────────────────────────────────────────╢
║ @USA.nnn.
║ @USA.nnn._addr2 is the 2nd street address ║
║ @USA.nnn.
║ @USA.nnn.
╟────────────────────────────────────────────────────────────────────────────────────────╢
▲║ @USA.nnn._addr3 is the 3rd street address ║
║ @USA.nnn.
╟────────────────────────────────────────────────────────────────────────────────────────╢
║ @USA.nnn.
╟────────────────────────────────────────────────────────────────────────────────────────╢
║ @USA.nnn.
╟────────────────────────────────────────────────────────────────────────────────────────╢
║ @USA.nnn.
╚════════════════════════════════════════════════════════════════════════════════════════╝
</pre>
<lang rexx>/*REXX program creates, builds, and displays a table of given U.S.A. postal addresses.*/
@usa.=; @usa.0=0;
@usa.0=@usa.0 + 1 /*bump the unique number for usage.
call USA '_city' , 'Boston'
call USA '_state' , 'MA'
call USA '
call USA '_name' , "FSF Inc."
call USA '_zip' , '02110-1301'
@usa.0=@usa.0 + 1 /*bump the unique number for usage.
call USA '_city' , 'Washington'
call USA '_state' , 'DC'
call USA '
call USA '_addr2' , "1600 Pennsylvania Avenue NW"
call USA '_name' , "The White House"
call USA '_zip' , 20500 /*no need for quotes for a number. */
call USA 'list'
exit
/*──────────────────────────────────────────────────────────────────────────────────────*/
tell:
list: call tell '_name'▼
do j=2 until $==''; call tell "_addr"j; end /*j*/▼
return
/*──────────────────────────────────────────────────────────────────────────────────────*/
▲tell: $=value('@USA.'#"."arg(1));if $\='' then say right(translate(arg(1),,'_'),6) "──►" $
if ?=='LIST' then do #=1 for @usa.0
return▼
▲USA: procedure expose @USA.; parse arg what,txt; arg ?; @='@USA.'
say
end
else do; call value $ || @usa.0'.'what , arg(2)
call value $ || @usa.0'.upHist' , userid() date() time()
'''output''' (data used is within the REXX program):▼
end
<pre>
name ──► FSF Inc.
city ──► Boston
zip ──► 02110-1301
─────────────────────────────────────────────
name ──► The White House
city ──► Washington
zip ──► 20500
─────────────────────────────────────────────
</pre>
|