Solved

sql command to call a cl program

Posted on 2006-11-06
12
1,153 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This article outlines why you need to choose a backup solution that protects your entire environment – including your VMware ESXi and Microsoft Hyper-V virtualization hosts – not just your virtual machines.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

809 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