Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

host structure arrays - SQL insert

Status
Not open for further replies.

George221

MIS
Dec 2, 2005
50
US
Hi,
Would anyone have an RPGLE example of gettting records loaded into a host data structure, then used in a SQL insert statement?
 
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
 
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.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top