Hi
who knows the syntax of using a data structure in VALUES part of INSERT sql command in RPG.
Actually my program inserts record in a table which has a lot of fields. I have a data structure(CUSTINFOREC) exactly as table record format in my program and fill it during the runtime. and now I prefer to replace my static INSERT by a dynamic one and use this data structure directly in INSERT command.
because this way :
DCUSTINFOREC DS INZ
DCIR_CUSNO 6
DCIR_CUSNM 35
DCIR_OD_LCD 5
DCIR_OD_DESC 35
.
.
.
EVAL INSRTSQL='INSERT INTO BAYAT/CUSTINFO'
EVAL INSRTSQL=%TRIM(INSRTSQL)+' VALUES('
EVAL INSRTSQL=%TRIM(INSRTSQL)+''''+CIR_CUSNO
EVAL INSRTSQL=%TRIM(INSRTSQL)+''','+''''
EVAL INSRTSQL=%TRIM(INSRTSQL)+CIR_CUSNM
EVAL INSRTSQL=%TRIM(INSRTSQL)+''','+''''
EVAL INSRTSQL=%TRIM(INSRTSQL)+CIR_OD_LCD
.
.
.
is very long (as the table has many fields) and I believe is not technically beautiful.
thank you
who knows the syntax of using a data structure in VALUES part of INSERT sql command in RPG.
Actually my program inserts record in a table which has a lot of fields. I have a data structure(CUSTINFOREC) exactly as table record format in my program and fill it during the runtime. and now I prefer to replace my static INSERT by a dynamic one and use this data structure directly in INSERT command.
because this way :
DCUSTINFOREC DS INZ
DCIR_CUSNO 6
DCIR_CUSNM 35
DCIR_OD_LCD 5
DCIR_OD_DESC 35
.
.
.
EVAL INSRTSQL='INSERT INTO BAYAT/CUSTINFO'
EVAL INSRTSQL=%TRIM(INSRTSQL)+' VALUES('
EVAL INSRTSQL=%TRIM(INSRTSQL)+''''+CIR_CUSNO
EVAL INSRTSQL=%TRIM(INSRTSQL)+''','+''''
EVAL INSRTSQL=%TRIM(INSRTSQL)+CIR_CUSNM
EVAL INSRTSQL=%TRIM(INSRTSQL)+''','+''''
EVAL INSRTSQL=%TRIM(INSRTSQL)+CIR_OD_LCD
.
.
.
is very long (as the table has many fields) and I believe is not technically beautiful.
thank you
Comment