Solved

sql command to call a cl program

Posted on 2006-11-06
12
1,155 Views
Last Modified: 2010-07-27
i know that its possible to call some programs from the as400 through a sql query, but can i access a cl program through a sql command?  we have used trigger files on the 400 previously to fire off programs, but it would be nice to just hit the program myself instead of messing with a trigger.
0
Comment
Question by:WMIF
  • 4
  • 3
  • 3
12 Comments
 
LVL 18

Expert Comment

by:daveslash
ID: 17885806
Preface the command with "CL: "

e.g.
CL: DSPJRN JRN(MyLib/QSQJRN) OUTPUT(*OUTFILE) OUTFILFMT(*TYPE4) OUTFILE(qtemp/dspjrn);

HTH,
DaveSlash
0
 
LVL 22

Author Comment

by:WMIF
ID: 17885828
just to be clear (because i am definately not a 400 person).  you have the name of the program, then several parameters that are specific to that program?  so if a cl program didnt take any parameters is would like like this?

CL: DSPJRN ;
0
 
LVL 27

Assisted Solution

by:tliotta
tliotta earned 100 total points
ID: 17885901
WMIF:

A CL program would be called through use of the SQL CALL statement just like any other program called with SQL.

As long as parameter values are not required to transmit from the system back to the client, the target program does not need to be registered as a stored procedure.

Tom
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 27

Expert Comment

by:tliotta
ID: 18064343
No objection as far as points go, but the OP should clarify whether the need is to execute a CL command or call a program (a CL program or otherwise).

Tom
0
 
LVL 27

Expert Comment

by:tliotta
ID: 18066693
Understood, that's why no objection on points. I'm just being an idealist. Questions can get closed without clear resolution at times, and I'd like future readers to benefit where possible.

Ideals can be difficult.

Tom
0
 
LVL 22

Author Comment

by:WMIF
ID: 18070484
sorry about this guys.  my intention was to get with the as400 programmer to do some testing, but he got busy with other projects and then i forgot.


>the OP should clarify whether the need is to execute a CL command or call a program (a CL program or otherwise)

im not sure that i understand the difference in the question.  maybe a command is referring to a built in program verses a custom written program?
0
 
LVL 18

Accepted Solution

by:
daveslash earned 200 total points
ID: 18070906
Sorry, I should have been more detailed.

If you're going to call a CL program within SQL, you'd simply put the CALL in the string.

e.g.
CL: call MyPgm PARM('parameter1' 'paramter2' 'parameter3');

HTH,
DaveSlash
0
 
LVL 18

Expert Comment

by:daveslash
ID: 18070917
Alternately, you could wrap your CL program as a stored procedure with the CREATE PROCEDUE statement. Then, from within SQL, you could simply call your program (withot prefacing it with "CL:")

DaveSlash
0
 
LVL 22

Author Comment

by:WMIF
ID: 18071046
thanks for that clarification, and more points for letting it go stale.
0
 
LVL 27

Expert Comment

by:tliotta
ID: 18073174
I wouldn't expect that the [CL:] prefix would be used for a CALL _unless_ there was a need to execute the CL CALL command itself. This should be different from running the SQL CALL statement for stored procedures.

No?

Tom
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Giving access to ESXi shell console is always an issue for IT departments to other Teams, or Projects. We need to find a way so that teams can use ESXTOP for their POCs, or tests without giving them the access to ESXi host shell console with a root …
This article describes how to reset your Windows 10 password when you've forgotten it.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question