I have a file that I need to replace daily with data from an SQL view. Currently I have been doing this by simply running CPYF with REPLACE
But now I have to do this while users have read locks on the target, CPYF gags. I tried doing it with SQL
ok that works, but then I want to repopulate
Now I know I must be missing something simple here, so what is it ? 
I know, I can write an RPG pgm to do it, but won't SQL also do it ?
Code:
CPYF FROMFILE(GPSVIEWS/ITEMASAVW) +
TOFILE(GPSVIEWS/ITEMASAV1) MBROPT(*REPLACE) +
CRTFILE(*YES) FMTOPT(*MAP *DROP)
Code:
DELETE FROM ITEMASAV1
Code:
insert into itemasav1 select * from itemasavw ERROR - Statement contains wrong number of values.

I know, I can write an RPG pgm to do it, but won't SQL also do it ?




Comment