Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Running Multiple AS/400 commands in one statement

1,679 views
Skip to first unread message

lcoll...@hotmail.com

unread,
Aug 20, 2008, 9:44:15 AM8/20/08
to
I am trying to add a query to the job scheduler and it needs to run
two queries. I setup the job using the following command:

RUNQRY QRY(LIB/QUERY1)

how do I change it to

RUNQRY QRY(LIB/QUERY1) and RUNQRY QRY(LIB/QUERY2)

is there a way to seperate them i tried commas, semi colon, etc but
nothing seems to work. is there not a way to run multiple commands in
one statement?

iseriesflorida

unread,
Aug 20, 2008, 9:52:11 AM8/20/08
to

You would have to create a seperate job entry or have 1 job entry to
call a program which will hold the 2 runqry statements.

MrDolom...@gmail.com

unread,
Aug 20, 2008, 10:49:47 AM8/20/08
to
Nope. The CMD parameter of the ADDJOBSCDE only takes a single item.
But, the name "CMD" is a little misleading. It will accept either an
actual IBM command, like RUNQRY, or it will take a call to a program,
like CALL PGM(RUNTWOQRYS) So all you need to do is create and compile
a CL program with the two RUNQRY commands from your original posting.
Then use that program in your job schedule entry and you will be good
to go.


On Aug 20, 9:44 am, lcollin...@hotmail.com wrote:

Karl Hanson

unread,
Aug 20, 2008, 12:17:55 PM8/20/08
to

Note that CALL is also "an actual IBM command" :)
===> DSPOBJD OBJ(QSYS/CALL) OBJTYPE(*CMD) DETAIL(*SERVICE)
Licensed program . . . . . . . . . . : 5761SS1 V6R1M0

Another option for grouping commands is SBMDBJOB, but that would run the
commands in a different (batch) job. A CL program also provides
capabilities like better error handling, etc.

--
Karl Hanson

CRPence

unread,
Aug 20, 2008, 4:47:23 PM8/20/08
to

I believe that QSHell may be the easiest way to issue the two
separate requests via just one request to the QSH command requested as
the one CMD() for the scheduled task on ADDJOBSCDE. Refer to the
utility named 'system' which enables a "Run CL command" function.
http://publib.boulder.ibm.com/infocenter/iseries/v5r4/topic/rzahz/rzahz.pdf

Something like the following for example may suffice; not tested, nor
syntax verified:

QSH CMD('system -nqvsK "RUNQRY LIB/QRY1"; system -nqvsK "RUNQRY
LIB/QRY2";')

Command list activity can be more sophisticated than what the
semicolon provides, but the ';' character provides serial and
synchronous requests.

If that were not an option, e.g. if the option giving that feature is
not available, then:

I am not aware of any system-supplied CL command processor that takes
a string of delimited commands as input from a parameter. The easiest
program to write that could do so, would probably be a REXX program that
assumes non-escaped semicolons as command delimiter. Then the STRREXPRC
can be the command invocation used for the scheduled request, with the
first parameter being parsed as the delimited command requests. The
biggest issue is how to handle errors; typical for scheduled requests,
ensuring dependencies are met across multiple requests.

Neither of the following rexx sources are verified to be correct for
syntax nor even functional. Nor have the sample STRREXPRC invocations
[that follow each code sample] been tested. They should give an idea of
how easy it can be; at least given command strings without apostrophes.

<code>
/* rexx source: DoCmds */
parse arg CmdLst

address "*COMMAND"
signal on error
CmdNbr=0 /* CmdNbr assignments & .CmdNbr stems are optional */
Do while CmdLst^=""
CmdNbr=CmdNbr+1
parse var CmdLst CmdStr.CmdNbr";"CmdLst
CmdStr.CmdNbr /* pass request to *COMMAND */
End
exit
error: say CmdStr.CmdNbr" failed."; exit 99
</code>

strrexprc DoCmds parm('RUNQRY QRY(LIB/QUERY1); RUNQRY QRY(LIB/QUERY2)')

<code>
/* rexx source: DoCmdsI */
parse arg CmdLst /* valid REXX and/or CL requests */

address "*COMMAND"
signal on error
interpret CmdLst /* interpret delimited requests */
error: exit 99
</code>

strrexprc DoCmdsI parm('"RUNQRY QRY(LIB/QUERY1)";"RUNQRY
QRY(LIB/QUERY2)";')

strrexprc DoCmdsI parm('Q1="QUERY1"; Q2="QUERY2"; "RUNQRY
QRY(LIB/"Q1")";"RUNQRY QRY(LIB/"Q2")";')

Regards, Chuck

JTF

unread,
Aug 23, 2008, 11:11:44 PM8/23/08
to
On Aug 20, 9:44 am, lcollin...@hotmail.com wrote:

I would handle this with a single CL program
basically, with 2 commands in the program
SBMJOB CMD(RUNQRY.........)......

Schedule the CL program, it will then spawn off the 2 queries to the
jobq of your choice or the default queue. This accomplishes what you
want, having the 2 queries run with a single job.

Want more, email me

0 new messages