)F REXX function - Write and read data to named storage area. Current build: 004 The purpose of the program is to allow a REXX program to store a string of data in common storage and retrieve it later, either from the same program or from another REXX program. REXXSTOR is reentrant and refreshable, so can reside in the LPAlib. REXXSTOR must be called as a function ! REXXSTOR sets the following variables: REXXSTOR_RC return code, not the same as the return value. See later for details. REXXSTOR_RS reason code when return code is not 0. Syntax: action,name,data|variablename|length action is folded to uppercase internally A Acquire a data block. This is sort-of a GETMAIN. Returns the address of the area. You can then use the STORAGE function to update and retrieve data. D Delete (release) the storage. G Get data from storage. If the 'variablename' parameter is used, then data will be written to the named variable, otherwise data will be in the return value. GA Get the address of the storage area. Useful if you intend to use the STORAGE function to update or retrieve data. the same information is returned from the A action. GX Same as G, plus the storage will be deleted (released) I Get some information about the storage area. P Write (put) data to storage. If the storageblock exists already, it will be overwritten. VER Return the program name and build. name Name of storage area. 1-8 bytes. Can be virtually anything. It is not folded to uppercase. data Data to write to storage. Used with action P. length Size of storage to acquire. Used with action A. variablename Name of variable to copy data to. Return: data if action is G or I address if action is A or GA ' ' if action is P, or if no data for action Gx Variable REXXSTOR_RC is set as follows: 0 all ok 1 missing or invalid parm 1 2 missing or invalid parm 2 3 missing or invalid parm 3 8 no data in requested block 9 unknown storage block 11 set of large return value failed 99 some other error, see reason variable Samples: cc = REXXSTOR('a','stblk1','200') /* get block */ va = REXXSTOR('ga','stblk1') /* get block address */ va = REXXSTOR('d','stblk1') /* remove block */ data = copies('a string ',100) cc = REXXSTOR('p','stblk2',data) /* write to store */ The STORAGE function can be used to store data directly in the data block, and retrieve data from the storage block, like this: Sample addr = REXXSTOR('a','stblk2',2000) /* acquire storage */ cc = Storage(addr,,'Kilroy was here') /* write string to storage */ resp = Storage(d2x(x2d(addr)+7),3) /* get 'was' */