Within an SQLRPGLE program I need to run an insert into statement to copy some records to another file having copied records assigned a new record ID. To do so I followed these steps:
1) Prototype a procedure to get a new record ID each time is called
D ri_box12 PR 13S 0 D wkFileName 10A Value2) Execute a dynamic SQL statement
C EVAL SQL_STM='insert into PGMR46/STD05GR0F' C +' (select CART, CARV, ' C +%char(ri_box12('STD05GR0F')) C +' from arasso0f)' C/EXEC SQL C+ execute immediate :SQL_STM C/END-EXEC3) Define ri_box12 procedure
P ri_box12 B D ri_box12 PI 13S 0 D wkFileName 10A Value D wkID S 13S 0 C DOThe point is that ri_box12 is called only once, so all copied records have the same ID; multiple runs of the program again copy all records with a new record ID.
** ...some instructions to give wkID a value C ENDDO C Return wkID P E
What did I do wrong or what am I missing?
Than you very much
Aucun commentaire:
Enregistrer un commentaire