Solved

sql command to call a cl program

Posted on 2006-11-06
12
1,141 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 27

Expert Comment

by:tliotta
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 22

Author Comment

by:WMIF
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
thanks for that clarification, and more points for letting it go stale.
0
 
LVL 27

Expert Comment

by:tliotta
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

A procedure for exporting installed hotfix details of remote computers using powershell
A safe way to clean winsxs folder from your windows server 2008 R2 editions
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now