CompuServe Messages

Superbase and Arexx

    04-Aug-93 22:07:40
Fm: Bob Chapman 76327,3116
To: David Masterson 73717,3301
David – Hope the following example helps. It is a simple arexx program that is run from the cli to add one record to SBase file that is already open. (I haven't tried this program under SBase4 v1.3 but it worked under previous SBase4 versions.) – – – – – – – – – – – – – – – – – – [Cut here] – – – – – /* AddRec.rexx – Add a SBPro record (to file already OPEN that has fields named FLD1, FLD2, FLD3 — Text, Text, Numeric — of proper size) */ pival = 3.14159 /* A constant for FLD3 of the new record */ call SndACmd 'BLANK' /* Have SBase create the new record */ call SndACmd 'FLD1="001"' /* Put values in fields */ call SndACmd 'FLD2="Wish you could send multiple commands:"' call SndACmd 'FLD3='pival /* FLD3 set to 3.14159 */ call SndACmd 'STORE' /* Have SBase store the new record */ exit /* SndACmd(cmd) – a procedure to send CMD to SBPro4 */ SndACmd: procedure parse arg cmd options no results /* Must Be 'NO results' for CMD to work */ signal on error /* Trap SB's dumb 4096 'OK' return */ address 'SBase4' cmd /* Send the command */ error: signal off error return – – – – – – – – – – – – – – – – – – – – [Cut Here] – – – – – – Note that the host name in the ARexx 'address' command IS CASE sensitive! i.e. if it is 'SBase4' then SBASE4 won't do — use "say show('P')" to be really sure. Further, if I remember correctly, for some unknown reason — you really DID have to have 'options no results' when you sent a SBase command to the SBase port. THEN if you wanted SBase to return some value to your ARexx program — you had to make sure that you had enabled results (options results) before you sent the request to the SBase port. Something like this: . . . . options results address 'SBase4' 'FLD1' /* Request value of FLD1 (in currently selected record */ if (RC = 0 | RC = 4096) then /* value is returned in ARexx RESULT var */ [ MORE ]