Solved

sql command to call a cl program

Posted on 2006-11-06
12
1,156 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
AS/400 Printout WTR status 2 527
RPG to c# 3 394
Domino Lotusscript Scheduled Agent Tranfer File from AS400 to another 6 125
AS400  SNDDST Truncating 5 104
After-hours service is a fact of life for most MSPs. While not the most pleasant aspect of the job, there are ways to make after-hours servicing a more profitable and organized enterprise.
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

679 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