VX (VSAM to REXX Variable) -- REXX only

Purpose
Copy records from a VSAM data set into a REXX stem variable.
Usage notes
Each record is copied to a variable named stem.nnn. stem.0 is a counter.
For example, if you copy 3 records, stem is VARXX. and VARXX.0 has the value 5:
  • The records are copied to VARXX.6, VARXX.7, and VARXX.8.
  • The value of VARXX.0 is reset to 8.

This function is available only from a REXX procedure.

Related function
XV
Copy a REXX stem variable to a VSAM data set
Figure 1. Syntax

1 VX
1! INPUT=VSAMIN
1 INPUT=ddname
1 DSNIN=dsname
2 VARNAME=stem
1! POSITION=0
1 POSITION=skip
1 KEY=key
1! NLRECS=ALL
1 NLRECS=nlrecs
ddname
Refers to a DD or TSO ALLOC statement. The default is VSAMIN.
dsname
Name of a VSAM data set.
key
A key for KSDS records, or a slot number for RRDS records. The maximum key length is 30 characters. The first record with a key or slot value greater than or equal to key is the first record copied. If you omit the key and skip values, copying begins with the first record in the data set.

If the key contains lowercase characters, blanks, or commas, enclose it in quotation marks. You can also specify a key in hexadecimal format (for example, X'C1C2C3').

nlrecs
Number of records to be copied or ALL. The maximum number is 99 999 999. If you specify ALL or omit the parameter, all the remaining records are copied.
skip
Number of logical records to be skipped from the beginning of the data set. If you omit the skip and key values, copying begins with the first record in the data set.
stem
A REXX stem variable name. The maximum length is 44 characters.
/* REXX */
/* Copy a VSAM data set to a REXX stem     */
/* Change input.vsam.file to the name      */
/* of the required VSAM file               */

"FILEMGR $VX  DSNIN='input.vsam.file',",
             "VARNAME=STEM."

/* Show stem contents                      */

do i = 1 to stem.0;
    say 'Record' i '=' stem.i;
    end;

return;