COPYR2S
COPYR2S copies REXX variable contents to GETMAINed storage.
Operands
- source_vname
- specifies the REXX variable containing the value copied to the
previously GETMAINed area. Note: This value should be in quotes so that substitution does not occur.
- *
- specifies that all the REXX variables are copied. If you specify an asterisk (*) you cannot specify fieldname.
- stor_anchor
- specifies the REXX variable containing the anchor for the target storage area that was GETMAINed earlier. This anchor consists of four bytes, containing the address of the earlier GETMAINed storage.
- offset
- specifies the displacement into the previously GETMAINed storage area, that the contents of the REXX variable is copied to. The first byte of the area is indicated by a displacement of zero.
- length
- specifies the length in decimal bytes of the copy performed. If this length is specified, then the contents of the source REXX variable is truncated, or padded with blanks to match this length, and then copied. However, the source REXX variable is not altered in this process. If this length is omitted, then the current length of the source REXX variable, is used.
- struct_vname
- specifies a REXX variable containing a structure definition (or mapping) of the fields in the GETMAINed storage area. The format of the data in this variable is: field1_name length ... fieldn_name length. This capability is provided so that field displacements are easily calculated and changed, from a central location.
- struct_name
- specifies the structure file ID containing a structure definition
(or mapping) of the fields in the GETMAINed storage area.
Structures are made up of records in the following format: fieldname location length type, where:
- fieldname
- specifies a 1 to 12 character symbolic name of the field.
- location
- specifies the position in structure that this field starts (the first position is 1).
- length
- specifies decimal length of this field in bytes.
- type
- specifies the field data type: C (character), F (fullword), or H (halfword).
- fieldname
- is a 1 to 12 character symbolic name associated with the destination field for this copy. This name must exist in the above specified REXX variable or structure definition file. The fieldname must be specified when struct_vname or struct_name is specified.
Return codes
- 0
- Normal return
- 2002
- Invalid operand
- 2021
- Invalid structure definition
- 2022
- Invalid variable structure definition
- 2023
- Field name not found
- 2025
- Failure processing GETVAR request
- 2026
- Invalid numeric input
- 2027
- RFS read error
- 2028
- Invalid offset
- 2029
- Invalid length value
Example
/* Needed if entering example from the REXXTRY utility */
'PSEUDO OFF'
'CICS GETMAIN SET(WORKANC) LENGTH(200)'/* get 200 bytes of working storage */
VAR1 = '00000000'x /* set a REXX variable with 4 bytes of hex */
'COPYR2S VAR1 WORKANC 4'
This example requests 200 bytes of virtual storage and copies the hex value of '00000000'x into bytes 4 through 7 of that area.
'CICS GETMAIN SET(WORKANC) LENGTH(200)'/* get 200 bytes of working storage */
VAR1 = 'ABC' /* set a REXX variable with 3 characters */
struct1 = 'flda 4 fldb 2 fldc 3 fldd 8 flde 5'
'COPYR2S VAR1 WORKANC STRUCT1 FLDC'
This example requests 200 bytes of virtual storage and copies the character string ABC to position 7 of the GETMAINed area referenced by anchor WORKANC.
