CA OPSMVS : SQL inserts fail with 'SYST(' value

Document ID : KB000118744
Last Modified Date : 12/02/2019
Show Technical Document Details
Introduction:
In CA OPSMVS REXX execution, the SQL inserts fail when any value contains the string 'syst(' or anything that resembles 'system('. 
For example, trying to add value 'START ONCASYSTEM(TY)' to user-defined column in SSM table : 
  • Script : 
/* rexx */ 
time = '04:00' 
pos = 3 
name = 'TEST001' 
parms = 'testing oncasystem()' 

cols = 'START_TIME POS NAME TYPE CURRENT_STATE DESIRED_STATE MODE', 
'PREMODE REFMODE ACTMODE PARMS PREREQ' 

vals = "'"time"' '"right(pos,3,'0')"' '"name"' 'WTOR' 'DOWN' 'DOWN'", 
"'ACTIVE' 'ACTIVE' 'ACTIVE' 'ACTIVE' '"parms"' ''" 

Address SQL "Insert into TECHW ("cols") values ("vals")" 

say sqlcode 

if sqlcode <> 0 then 
do queued() 
pull line; say line 
end
  • Result: 
-7812 
OPM1942E SYNTAX ERROR NEAR: ' '') 
OPM1946E --- MISQUOTED TEXT STRING 
OPM7812E SQL SYNTAX ERROR DETECTED IN PARSE 
***  

 
Environment:
Z/OS  CA-OPSMVS 
Instructions:
It is possible to bypass the error putting the 'SYST(' string field in a variable and asking directly to SQL to resolve it before doing the insert. 

Here a sample REXX that can be used : 

/* REXX */ 
ADDRESS SQL, 
"DELETE FROM HEXA" 
ADDRESS SQL, 
"DROP TABLE HEXA" 
ADDRESS SQL, 
"CREATE TABLE HEXA", 
"(KEY1 CHAR(4) NOT NULL PRIMARY KEY,", 
" DATA CHAR(10))" 
VAR1='ONSYST(TY)'                                       ------------- var1 variable used with the syst string --------------- 
KEY1='1' 
ADDRESS SQL, 
"INSERT INTO HEXA (KEY1,DATA) VALUES ('"KEY1"',:VAR1)"  ------------- SQL resolving the variable before insert -------------- 
DO QUEUED() 
PULL L 
SAY L 
END 



So using : 

:var1 

SQL and not the REXX will resolve this variable.
In the initial REXX the instruction : 

vals = "'"time"' '"right(pos,3,'0')"' '"name"' 'WTOR' 'DOWN' 'DOWN'", 
"'ACTIVE' 'ACTIVE' 'ACTIVE' 'ACTIVE' '"parms"' ''" 

should be :

vals = "'"time"' '"right(pos,3,'0')"' '"name"' 'WTOR' 'DOWN' 'DOWN'", 
"'ACTIVE' 'ACTIVE' 'ACTIVE' 'ACTIVE' :parms ''"