Question

  Asked: May 6 2008   3:32 PM GMT
  Asked by: Tcwalls


Error when executing RUNSQLSTM from CL program


AS/400, SQL, RUNSQLSTM, AS/400 errors, CL

I am trying to use the RUNSQLSTM command. I get the error message "statement not allowed"

Not really trying anything fancy.

In CL program

RUNSQLSTM SRCFILE(jwe/QCLSRC) SRCMBR(SQL1) +
COMMIT(*NONE)


In SQL1 I have

SELECT mstid,
SUBSTR(ftxref,1,1) AS ftxref_1,
SUBSTR(HEX(SUBSTR(ftxref,2,7)),1,9) AS char,
ftext,
ftxtno
FROM MEDPDATA/ftxp010
WHERE SUBSTR(ftxref,1,1) NOT IN ('A','M')
AND ftxref NOT IN (SELECT scrcod
FROM tabp160)
UNION
SELECT mstid,
SUBSTR(ftxref,1,1) AS ftxref_1,
SUBSTR(ftxref,2,7) AS char,
ftext,
ftxtno
FROM MEDPDATA/ftxp010
WHERE SUBSTR(ftxref,1,1) IN ('A','M')
AND ftxref NOT IN (SELECT scrcod
FROM tabp160)

Subscribe to Alerts! Get questions and answers delivered to your Inbox.


E-mail me updates on this question



   SUBSCRIBE

hidden modal window

Answer Wiki (Improve, edit or add to this answer)


 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0



You cannot run a SELECT using RUNSQLSTM.
  • AddThis Social Bookmark Button

Browse more Questions and Answers on AS/400 and Development.

Looking for relevant AS/400 Whitepapers? Visit the Search400.com Research Library.


Discuss This Answer


You must be logged-in to discuss a question. Log-in/Register

Gilly400  |   May 7 2008  2:07PM GMT

Oops, I hadn’t noticed that it was a SELECT from RUNSQLSTM, I thought it was an embedded SELECT.

So I guess this’ll work OK from STRSQL.

Dave is right, RUNSQLSTM doesn’t know what to do with output from a SELECT.