Table creation/Postal addresses: Difference between revisions
Content added Content deleted
Walterpachl (talk | contribs) (→{{header|REXX}}: add Version 2 for each and every REXX) |
|||
Line 548: | Line 548: | ||
=={{header|REXX}}== |
=={{header|REXX}}== |
||
===version 1=== |
|||
A REXX program can call SQL or any other database system, but the version shown here is a RYO (roll your own). |
A REXX program can call SQL or any other database system, but the version shown here is a RYO (roll your own). |
||
<br>Practically no error checking (for invalid fields, etc.) has been coded |
<br>Practically no error checking (for invalid fields, etc.) has been coded |
||
Line 654: | Line 655: | ||
──────────────────────────────────────── |
──────────────────────────────────────── |
||
</pre> |
</pre> |
||
===version 2=== |
|||
<lang rexx>/* REXX *************************************************************** |
|||
* 17.05.2013 Walter Pachl |
|||
* should work with every REXX. |
|||
* I use 0xxx for the tail because this can't be modified |
|||
**********************************************************************/ |
|||
USA.=''; USA.0=0 |
|||
Call add_usa 'Boston','MA','51 Franklin Street',,'FSF Inc.',, |
|||
'02110-1301' |
|||
Call add_usa 'Washington','DC','The Oval Office',, |
|||
'1600 Pennsylvania Avenue NW','The White House',20500 |
|||
call list_usa |
|||
Exit |
|||
add_usa: |
|||
z=usa.0+1 |
|||
Parse Arg usa.z.0city,, |
|||
usa.z.0state,, |
|||
usa.z.0addr,, |
|||
usa.z.0addr2,, |
|||
usa.z.0name,, |
|||
usa.z.0zip |
|||
usa.0=z |
|||
Return |
|||
list_usa: |
|||
Do z=1 To usa.0 |
|||
Say ' name -->' usa.z.0name |
|||
Say ' addr -->' usa.z.0addr |
|||
If usa.z.0addr2<>'' Then Say ' addr2 -->' usa.z.0addr2 |
|||
Say ' city -->' usa.z.0city |
|||
Say ' state -->' usa.z.0state |
|||
Say ' zip -->' usa.z.0zip |
|||
Say copies('-',40) |
|||
End |
|||
Return</lang> |
|||
<pre> name --> FSF Inc. |
|||
addr --> 51 Franklin Street |
|||
city --> Boston |
|||
state --> MA |
|||
zip --> 02110-1301 |
|||
---------------------------------------- |
|||
name --> The White House |
|||
addr --> The Oval Office |
|||
addr2 --> 1600 Pennsylvania Avenue NW |
|||
city --> Washington |
|||
state --> DC |
|||
zip --> 20500 |
|||
----------------------------------------</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |