Using DDA/400 ddaRunSQL Function
From Support
For AS/400s with the DB2/400 licensed program installed, DDA/400 Version 2.0 provides a new function, ddaRunSQL, to allow processing of DB2/400 SQL statments. Typically, the SQL statement contains some form of the “create view” SQL syntax; the results of the processing is a DB2/400 view, which can be treated as a non-keyed logical file and opened and accessed with DDA/400.
Refer to the DB2/400 manuals for more information on how to use the SQL syntax to create views containing selected records.
A temporary logical view should be created in QTEMP based on the file that is being opened.
As an example of this method of SQL processing, consider the following…
qry$ = “CREATE VIEW QTEMP/CSTQ01 AS SELECT * FROM CST/CSTP01 WHERE STATE = ‘GA’ ” res = ddaRunSQL( session, qry$)
A logical view, CST/CSTQ01, now exists that can be opened and accessed with DDA/400.
Including ddaRunSQL in a CoreCode generated VB module. Add the following line to the .BAS module:
Declare Function ddaRunSQL Lib "dda40032.dll" (ByVal Session As Long, ByVal SQLStmt As Any) As Integer
Note: 7/31/2005 - The RJS iSeries Data Access Provider - ASP400 should be considered as a replacement for DDA/400 because of the much simplified coding style for opening and accessing AS/400 - iSeries tables.
Categories: DDA/400 | Knowledge Base | How To | TBPR
