PDA

View Full Version : coding style for back end RPG



dlstrawn
04-05-2010, 12:28 PM
I guess this is mostly for the CNX Dev. team, but anyone can respond. How do developers that develop with Valence, access DB2: Through RPG reads and writes (native IO)... or with embedded SQL?

robert.swanson
04-05-2010, 01:12 PM
I see a combination of both. If you're just retrieving a single record from a keyed file, native IO (chain) will typically be faster than executing an SQL statement on the back end. But for retrieving sets of records, an SQL statement is usually the best route. And with the improvements made to the ExecSQLtoJSON routine in Valence 2.1, you can use dynamic SQL now without seeing the performance hit you might've seen in prior releases.

sean.lanktree
04-05-2010, 04:37 PM
Like Rob, I use a combination of both, it just depends on the situation. I normally use sql (via vvOut_execSqlToJson) for grids and combo boxes. If only retrieving a single record, I always use native i/o.

richard.milone
04-05-2010, 06:10 PM
As a general rule of thumb, yes, execSQLtoJSON is good for grids and combo boxes and single record access is better with native i/o. However, when you have very large files the SQL might not perform well, especially if you let users do dynamic sorting and/or searching on every column. What I normally do is always start with execSQLtoJSON (since it's so easy to implement), then if testing shows poor performance I'll move to native i/o. There are examples of both included with Valence.