Skip to content

Instantly share code, notes, and snippets.

@greghelton
Last active December 1, 2020 23:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greghelton/ca4be0f024957a4fbec595007fa108a7 to your computer and use it in GitHub Desktop.
Save greghelton/ca4be0f024957a4fbec595007fa108a7 to your computer and use it in GitHub Desktop.
**free
dcl-s x packed(3:0) inz(0);
dcl-s y char(10) inz('Texas');
dcl-s key char(10);
dcl-s val char(20);
dcl-s mysql CHAR(250)
inz(‘SELECT key1, prop1 FROM states_afflictions where key1 = ? UNION ALL +
SELECT key2, prop2 FROM states_afflictions where key2 = ? UNION ALL +
SELECT key3, prop3 FROM states_afflictions where key3 = ? for read only’);
exec sql
prepare s1 from :mysql;
exec sql
declare C1 cursor for s1;
exec sql
open C1 using :y, :y, :y;
dow SQLCOD = 0 AND X < 10;
exec sql
fetch next from C1 into :key, :val;
x = x + 1;
dsply val ; // at this point place data into table
enddo;
*INLR = *ON;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment