As400 Call Cl Program From Sql

Update myFile set myQty = 0 where myType = 'A'; cl: call myProgram ( 'A' '2010' ); select sum ( myQty ) from myFile; I read CL as Command Line rather than Control Language so that is the way I thought of it. Gta Makes it just a little bit more acceptable to use. There are some examples in the Run SQL drop down examples list which clued me on to using this ages ago. /* Display Dependent Files */ CL: DSPDBR FILE(library1/table1) OUTPUT(*OUTFILE) OUTFILE(qtemp/dspdbr); SELECT * FROM qtemp.dspdbr; /* Display Program References */ CL: DSPPGMREF PGM(qtemp/(*ALL)) OUTPUT(*OUTFILE) OBJTYPE(*ALL) OUTFILE(qtemp/dsppgmref); SELECT * FROM qtemp/dsppgmref.

Oct 29, 2008 - You can call the system program QZDFMDB2 and pass it one parameter with the SQL string to execute. In this case the SQL string is the call to. An SQL CALL is used to call an SQL stored procedure, not a CL program. There are a number of ways to handle this. If you need to return parameter values from your CL to the SQL stored proc, then you need to create an external stored procedure for the CL program that you want to.

Hello Newsgroup, I try to work with a Trigger which calls a ILE-RPG-Pgm. I start the Trigger with 'ADDPFTTRG'. For 'Insert' and 'Update' Functions it works fine.

By 'Delete' Operations is the Situation, that the triggered Record is not the Record I deleted in my Application. I don't know what happens. My Idea is now, to create a Trigger with a SQL Cmd: 'Create TRIGGER.' As I red in the IBM Documentation, it is not possible to call a ILE Pgm from an interactive SQL Statement. Is that true?

Compile cl program as400

Any information is welcome. Thanks in Advance Oliver Jonathan Ball 3/3/2005, 10:49 น. Oliver Baumann wrote: > Hello Newsgroup, > > I try to work with a Trigger which calls a ILE-RPG-Pgm. > I start the Trigger with 'ADDPFTTRG'. For 'Insert' and 'Update' Functions it > works fine. By 'Delete' Operations is the Situation, that the triggered > Record is not the Record I deleted in my Application. I don't know what > happens.

> My Idea is now, to create a Trigger with a SQL Cmd: 'Create TRIGGER.' As > I red in the IBM Documentation, it is not possible to call a ILE Pgm from an > interactive SQL Statement. > Is that true? Download and install directx 11 windows 7. No, it isn't true. You can call a high level language (HLL) program, e.g. RPG, COBOL, C, CL, etc., from within a SQL trigger. However, you first must register the program as an external stored procedure using the CREATE PROCEDURE statement.

Here's an example of an update trigger that calls an RPGLE program: 1. Create a test table for the trigger: create table ball.test_table (the_col char(5)); 2. RPGLE program TEST8 to be called by the trigger: h bnddir('QC2LE') dftactgrp(*no) d Test8 pr d newval 5 d Test8 pi d newval 5 d CmdToRun pr 10i 0 extproc('system') d Cmd * value options(*string) /free CmdToRun('sndmsg 'the value: ' +%trim(newval) + '' tomsgq(ball)'); // executes: sndmsg 'the value: xxxxx' tomsgq(ball) return; /end-free 3. Create an external stored procedure for the program: create procedure ball.test8 (char(5)) language rpgle parameter style general no sql external name ball.test8 4.

Create the trigger: create trigger ball.check_update after update of the_col on ball.test_table referencing old as old_line new as new_line for each row mode db2row when (old_line.the_col = ' ' and new_line.the_col ' ') begin declare wcol char(5); set wcol = new_line.the_col; call ball.test8 (wcol); end; 5. Test the trigger: insert into ball.test_table values(' '); update ball.test_table set the_col = 'abcde'; Message queue: >From..: BALL 03/03/05 10:44:47 the value: abcde Oliver Baumann 4/3/2005, 3:50 น.