)F REXX function - VSAM db bulk access Current build: 027 Fixed in this build Fix problem with 1 char after last asterix i.a. ABC*F Test for pos/endpos being numeric to avoid abends New in this build none Changes in this build none The program can add, replace, retrieve or delete records from a VSAM database. Access is normally by key/keyprefix, but some functions allow access based on text anywhere in the record. Data is either read from a REXX stem or stack, or written to a REXX stem or stack. VSAM types KSDS and fixed-length RRDS are supported. Initial load of both types is supported. RXVSAMBA is reentrant and refreshable, so can reside in the LPAlib. RXVSAMBA must be called as a function ! RXVSAMBA sets the following variables: RXVBVERS version info RXVBREAD number of reads RXVBWRIT total number of writes (updates+inserts) RXVBINSE number of inserts RXVBUPDT number of updates RXVBDELE number of deletes RXVBKEYL key length from the ACB RXVBKEYP key position from the ACB RXVBRECL data base lrecl RXVBDBTY data base type K=KSDS, R=RRDS RXVBERRM error message The program returns a return value 0 all ok >0 some error, check the RXVBERRM value ** warning ** Build 015 Redefines the use of operands LIST(name) and KEYSTEM(name). Changes the FILTER(name) operand to TEXTSTEM(name). Redefines the use for the RXVBWRIT variable Syntax rc=RXVSAMBA(action required-parameters other-parameters) Required parameters - must be used in all calls DD(ddname) Refers to the database or DA(datasetname) Name of the database, it will be allocated dynamically and freed. Read database records GET STEM(stemname) Copy records to stem 'stemname'. STACK Copy records to the stack. Either STEM or STACK is required, they are mutually exclusive. KEY(key-value) KSDS: select by specific key, note that leading and trailing blanks are stripped. RRDS: record number, leading zeros are added internally. KEYVAR(var-name) Name of variable containing key, including leading or trailing blanks. KEYSTEM(stemname) Select by keys in stem. MASK(mask) [POS(start)] [ENDPOS(end)] Scan the entire database, select by mask. Mask wildcards are '%' for one character and '*' for any number, incl no, characters. TEXT(text) [POS(start)] [ENDPOS(end)] TEXTSTEM(stemname) [POS(start)] [ENDPOS(end)] Scan the entire database, select by value 'text' or text in stem 'stemname' TO(to-val) RRDS only, ending record number to retrieve. KEY and MASK may be used together, thereby significantly reducing wild-card search time. I.e. 'KEY(M) MASK(M*NTH*)' will often be much faster than just 'MASK(M*NTH*)' Get data by key to stem, delete retrieved records. PULL operands Same operand syntax as for the GET command. Delete database records. DELETE KEY(key-value) Select by specific key. KEYVAR(var-name) Name of variable containing key, including leading or trailing blanks. KEYSTEM(stemname) Select by keys in stem. MASK(mask) POS(start) [ENDPOS(end)] MASKSTEM(stemname) POS(start) [ENDPOS(end)] TEXT(text) POS(start) [ENDPOS(end)] TEXTSTEM(stemname) POS(start) [ENDPOS(end)] Scan the entire database, select by value 'text' or text in stem 'stemname' LIST(stemname) Copy deleted records to list. KEY and MASK may be used together, thereby significantly reducing wild-card search time. I.e. 'KEY(M) MASK(M*NTH*)' will often be much faster than just 'MASK(M*NTH*)' Insert records - records must be sorted in ascending order and must be new. INSERT STEM(stemname) Insert records from stem 'stemname'. STACK Insert records from the stack. Either STEM or STACK is required, they are mutually exclusive. Add records - records need not be sorted, exising records are updated. PUT STEM(stemname) Add records from stem 'stemname'. STACK Add records from the stack. Either STEM or STACK is required, they are mutually exclusive. VALUE(text) 'text' is the data to add, max length 120 bytes. If output is to a RRDS then value must start with an 8-byte record number. Retrieve information about the cluster INFO Sets the following variables: RXVBKEYL key length RXVBKEYP key offset RXVBRECL max record length RXVBDBTY data base type K=KSDS, R=RRDS Retrieve the program build info VERSION returns version info, i.e. RXVSAMBA.020 2019-01-26 14.12 Sets the following variable RXVBVERS Notes to syntax Stemname must have a dot '.' at the end. Key-value can be a key prefix. Key-value and value are case sensitive. KEY specification. The KEY operand is stripped by leading and trailing blanks. This maens that if you specify a key with a length shorter than the database reclen, then an additional READ is done, due to the key-sequential processing done for keyed request. This can be avoided by one of these means: Use the KEYVAR or KETSTEM operand, values there are not stripped. Pad the KEY value to the db reclen and add a non-blank at the end. The KEY value is truncated to the DB reclen internally. Samples See the RXGVIVP1 member. RRDS Support The program now supports fixed-length RRDS databases. All the GET and PUT features are available, plus the GET .. TO (to-val) option. DELETE and thus PULL are not supported for RRDS as you cannot delete records in a RRDS, only replace. INSERT works as an alias for PUT, so you really should use just the PUT command. Records have the following format: 1-8 record number 9- data This format must be also used when adding data. Even though data is stored as fixed length, they need not be filled to the lrecl when added, as records are padded with blanks when stored and stripped for trailing blanks when retrieved. Records can be written in any order. Sample read, get slots 6-8 to list cc=RxVsamBa('get dd(rrds) stem(lst.) key(6) to(8)') Sample read, get slots 8, 6, 4 and 2 to list parse value '4 8 6 4 2' with ks.0 ks.1 ks.2 ks.3 ks.4 cc=RxVsamBa('get dd(rrds) stem(lst.) keystem(ks.)') Sample write, (re) write slots 11, 13 and 15: new.1= '00000011RXVSAMBA supports' new.2= '00000013VSAM fixed-length RRDS databases' new.3= '00000015as of build 022' new.0= 3 cc=RXVSAMBA('put dd(rrds) stem(new.)')