Nov 20, 2007 #1 George221 MIS Joined Dec 2, 2005 Messages 50 Location US Hi, Would anyone have an RPGLE example of gettting records loaded into a host data structure, then used in a SQL insert statement?
Hi, Would anyone have an RPGLE example of gettting records loaded into a host data structure, then used in a SQL insert statement?
Nov 21, 2007 #2 Mercury2 Technical User Joined Feb 27, 2004 Messages 422 Location FR Code: d W_MyFile e ds extname(MyFile) d prefix(W_) /free // Read MyFile into data structure W_MyFile Read MyRec MyFile; ... // Fld1, Fld2, etc belong to file MyFile Exec sql insert into MyNewFile ( Fld1, Fld2, ... ) values( :W_Fld1, :W_Fld2, ... ); The semicolon is mandatory to insert a variable into an sql stm. hth Upvote 0 Downvote
Code: d W_MyFile e ds extname(MyFile) d prefix(W_) /free // Read MyFile into data structure W_MyFile Read MyRec MyFile; ... // Fld1, Fld2, etc belong to file MyFile Exec sql insert into MyNewFile ( Fld1, Fld2, ... ) values( :W_Fld1, :W_Fld2, ... ); The semicolon is mandatory to insert a variable into an sql stm. hth
Nov 21, 2007 Thread starter #3 George221 MIS Joined Dec 2, 2005 Messages 50 Location US Is this structure an array? I do not want to do single row inserts. I'm also not sure how to deal with loading the array. Upvote 0 Downvote
Is this structure an array? I do not want to do single row inserts. I'm also not sure how to deal with loading the array.