Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

call AS400 program

Hi,

I need to call an AS400 pgm by using a macro?

someone knows tell me what are the commands?

This is an example I made:

sub ChiamoPgmAS
AS400Pgm = "((CALL PGM (MKWILLIAM \ DWFM41P.CLP) Parma ('2009010120091231')}}"
end sub

but does not work ...
8 Replies
johnan
Creator III
Creator III

Do you have the ODBC connection?

Not applicable
Author

Yes,

in the script I have already reported a specific sql file as400 ...
I just need to run a pgm on as400 always ...
I thought using a macro ...
Not applicable
Author

You should use the API. ActiveX-Control of the Programmers Toolkit.

Take a look here:

http://www-03.ibm.com/systems/i/software/access/windows/toolkit/remote_command.html

Not applicable
Author

unfortunately the download site ibm goes wrong ...

try later ...
Anonymous
Not applicable
Author

I think you need to create a procedure using the 'create procedure' instruction in sq session on AS/400

you can call the procedure with the sql 'Call' instruction

also make sure your odbc connection alows running procedures and has th enecessary libraries in the library list

Anonymous
Not applicable
Author

I think you need to create a procedure using the 'create procedure' instruction in sq session on AS/400

you can call the procedure with the sql 'Call' instruction

also make sure your odbc connection alows running procedures and has th enecessary libraries in the library list

jpengiu
Contributor III
Contributor III

The best way is create a STORED PROCEDURE on ISeries.

On Iseries there are two differents type of procedures:

"SQL stored procedure" and "External stored procedure".

An Sql stored procedure is vincolate at SQL

with External procedure you can call an external program on Iseries (RPGLE, CL, C , COBOL.....)

there are two way to create a procedure:

1) in a SQL session on Iseries ( IBM manual "DB2 for i SQL Reference"

I.e.

Create procedure procedure_name

(in field1 char(5), out field2 decimal(3))

language sql reads sql data

seletct max(qta) from pfile_name where fieldx=field1

2) on Windows program bar "IBM System I Access for Windows" and then "System I Navigator".

In System I Navigator open your Iseries tree Database/library/Procedure.

Here you can create a procedure

In a procedure you can define IN, OUT and INOUT parameters.

Simple example without parameters:

On Iseries create a CL program lib/procedure_name

es:

PGM

CLRPFM FILE(LIB/FILENAME)

ENDPGM

On SQL session on Iseries

CRATE PROCEDURE lib/procedure_name

LANGUAGE CL

PARAMETER STYLE GENERAL

this create in lib the procedure procedure_name that start program with the same name.

So in  lib there are the procedure and the program with the same name.

On Qlik script you create the ODBC string to connect to iseries and the command to call the procedure:

CONNECT TO [Provider..................

sql

call iseries.procedure_name;

jpengiu
Contributor III
Contributor III

When you call a  iSeries program , the list library used is the ODBC driver library list.

On configuration ODBC system i Access for Windows there is Server/Library list