/* rx
**
** Insert a new dataset in the address project
*/

options results

ADDRESS REXX_AB1

projectname = "AmigaBase:Data/English/Address"

ChrName  = "Steffen"
Name     = "Gutmann"
Street   = "Wiesentalstr. 30"
Town     = "D-73312 Geislingen"
Phone    = "+49-7331-63301"
Fax      = "+49-7331-69142"
Birthday = "28.11.1968"
Misc     ="Informatik-Student"

/*
** switch to project
*/
project projectname
if result == 0 then
do
   /*
   ** project not already in memory, load it.
   ** First open a new window.
   */
   New
   if result == 0 then
   do
      say "Can't open new project"
      exit
   end
   Load projectname
   if result == 0 then
   do
       say "Can't load" projectname
       exit
   end
end

/*
** Call the _Insert function (AmigaBase program).
** The arguments are converted into a memo variable called arg1.
** The arguments are surrounded with double quotes (awk like).
*/
Function _Insert '"'ChrName'" "'Name'" "'Street'" "'Town'"
                  "'Phone'" "'Fax'" "'Birthday'" "'Misc'"'

/*
** perform some error checking. AmigaBase sets the variable
** rexx_ab.lasterror when an error has been occured.
*/

if rc ~= 0 then say rexx_ab.lasterror

