Thanks guys.
Where was captain obvious when I needed him.
Regards,
Richard Schoen
Director of Document Management
e. richard.schoen@xxxxxxxxxxxxxxx
p. 952.486.6802
w. helpsystems.com
----------------------------------------------------------------------
message: 1
date: Thu, 21 Jul 2016 07:17:05 -0400
from: Rob Berendt <rob@xxxxxxxxx>
subject: Re: Question on using QZDFMDB2 to run SQL interactively in a
CL program
<snip>
RUNSQL SQL('INSERT INTO QTEMP.JUNK (JUNK) VALUES
(''This is a test 2'')
') COMMIT(*NONE) NAMING(*SQL) </snip>
That was my first thought also. The only problem being those who slaughtered the IBM RUNSQL command so they wouldn't have to modify code containing earlier homegrown versions of RUNSQL (right Paul Nelson?).
Rob Berendt
--
IBM Certified System Administrator - IBM i 6.1 Group Dekko Dept 1600 Mail to: 2505 Dekko Drive
Garrett, IN 46738
Ship to: Dock 108
6928N 400E
Kendallville, IN 46755
http://www.dekko.com
From: CRPence <crpbottle@xxxxxxxxx>
To: midrange-l@xxxxxxxxxxxx
Date: 07/20/2016 08:26 PM
Subject: Re: Question on using QZDFMDB2 to run SQL interactively in
a CL program
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>
On 20-Jul-2016 17:32 -0500, Richard Schoen wrote:
Using the following call in a CL works fine and allows me to use
current job QTEMP library to insert a record to a file in QTEMP.
However the call prompts at the end to "Press Enter to end terminal
session."
CALL PGM(QZDFMDB2) PARM('INSERT INTO QTEMP.JUNK (JUNK) VALUES
(''This is a test 2'') ')
Any ideas what I might need to override to get rid of the prompt in
an interactive job ?
crtpf qtemp/null rcdlen(1) mbr(null) maxmbrs(1) size(1 0 0)
ovrdbf stdout qtemp/null inhwrt(*yes) ovrscope(*calllvl)
CALL QZDFMDB2 PARM('INSERT INTO QTEMP.JUNK (JUNK) VALUES
(''This is a test 2'') ')
/* optionally, or as required, also: */
dltovr stdout
dltf qtemp/null
I can use the PASE equivalent below if needed, but can't access
files in current job QTEMP library:
QSH('Db2 "INSERT INTO QTEMP.JUNK (JUNK) VALUES
(''This is a test 2'')" ')
FYI, that is Start QSH, the QSHell, not PASE. And indeed, that would
run under a separate process. So that request would seem unusable, if
the intent is to get data into the file in the current process; as seems
implied by the attempt with the prior CALL.?.?
Any thoughts appreciated.
IMO, the following seems much simpler:
RUNSQL SQL('INSERT INTO QTEMP.JUNK (JUNK) VALUES
(''This is a test 2'')
') COMMIT(*NONE) NAMING(*SQL)
And depending on what is the definition of the file JUNK, and given
more complete requirements [besides what might be inferred with just
this contrived example], there may be other, even better, ways to get
the literal [or more dynamic] data into the file.
As an Amazon Associate we earn from qualifying purchases.