ISeries / AS400 FAQ : (Category) Programming : (Category) SQL : Can I use SQL in a CL program?

While one can't directly embed SQL in a CL program, there are several techniques that allow one to process SQL statements. One method is to place the desired SQL statements (no SELECT!) in a source member and using IBM's RUNSQLSTM command to process that source member. Another method is to use QMQRY to process SQL statements.

A very old edition of News/400 has the basic concept described. Basically, QMQRY allows the use of substitution parameters in SQL statements, like SELECT NAME FROM CUSTMAST WHERE ZIP = &ZIP This gets compiled with CRTQMQRY and then run with STRQMQRY SETVAR((ZIP 02134)) The trick employed by the magazine article was to make the entire statement a variable! &STMT This gets run with STRQMQRY SETVAR((STMT SELECT * FROM CUSTMAST)) This works for very short statements, but QMQRY has a limit of 50 characters for each variable.

More.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions


Thank You!
send