Download presentation
Presentation is loading. Please wait.
Published byAda Lang Modified over 6 years ago
1
EGL and IBM i Connectivity, Calling things, JDBC properties
Claus Weiss
2
EGL and Remote Programs on IBM i
Topic Sub-Topics: EGL Calls to Remote Programs (Overview) Calling programs on IBM i Invoking a command Invoking a procedure in a Service Program Dealing with members date fields on IBM i
3
Calling programs In this section you will learn how to call programs running on an IBM i. Here’s what you need to do: Add the iSeries JT400 toolkit to your project 2. (For each program to call) Add a callLink entry to the EGL Linkage Part for your Build File 3. Create the business logic to call the RPG Program First we will start with an overview of the system architecture and process EGL Logic Part call program…
4
Calling RPG Programs - Overview
Calling a RPG, COBOL, CL, or other program on the System i from EGL is as simple as coding: call “myProgram” (parm1, parmN); The facility is however extremely flexible and supports the many options that may be required to support many possible options and configurations. EGL takes into account the many possible runtime options that may affect how you run your jobs and call the RPG programs. EGL uses the System i Toolbox for Java™ to call programs on the System i. The toolbox in turn uses the i5/OS Remote Command server that is a part of the i5/OS Host Servers. The Remote Command server in i5/OS consists of a server daemon program that listens for TCP/IP requests from “clients”. This program is QZRCSRVSD which runs in the QSYSWRK sub-system. When the Remote Command Server starts, it starts a number of “worker” jobs that process requests in the QUSRSYS sub-system. These jobs are all named QZRCSRVS. The next slide describes this process in graphical and technical (in the Notes section) detail Note: When using pre-started jobs, UDATE will return date value of start of job not the date time of program start. Use timestamp at start of program to get system time at start of program
5
Calling RPG Programs – System Architecture
Your EGL application calls programs through a series of Qxxx system modules, via the JT400.JAR (Java) toolbox If calling programs directly Property: remotePgmType: stateless or stateful red path Else generated COBOL call blue path Notes: In this lab you'll attempt to call an RPG program that is running on the IBM Dallas mainframe. To successfully test the call you need free and clear access to the internet. If you're running this lab inside a firewall-protected network there's a very good chance you will not be able to execute. You will however learn how to call RPG – and you should be able to transfer these steps to calling your own RPG modules in your shop. Note2. This slide illustrates the typical flow of a call from an EGL program to an i5/OS application program. In this scenario an EGL developer may be working on RDI SOA on their workstation and running an EGL application under the WebSphere Test Environment. The workstation will utilize the Java Toolbox to establish a connection with the Remote Command server on the System i QZRCSRVSD). The remote command server daemon (QZRCSRVSD) will locate an available work job (QZRCSRVS in the QUSRWRK sub-system). The user is authenticated. The SWAP ID API will be issued to switch the QZRCSRVS job from QUSERS to the ID passed in by EGL. The program QVGNSVR will be invoked. This program in turn will call the QVGNRNCL CL program that starts commitment control in the job (if required) and then call the QVGNSETP CL program to add any required libraries to the job’s library list. In RBD 7.1 two additional properties on the lnakage file have been introduced that allow to directly call an IBM i program without using the QVGNRNCL program, the two properties are: Stateful Stateless These are only valid on IBM i for programs not generated by EGL and you will need to specify the property remoteComType JAVA400 in order to use them. When using stateless or stateful, you will not need the QEGL library and any of the QVGN* programs on your IBM i system. Finally the user program will be called. Return parameters will be returned up the path back to the invoking EGL program. You can find the QEGL library in a savefile in the RDI SOA install directories Use RSE to access your local directories and copy the savefile using copy/paste in the RSE tree view to your IBM i system. Restore the library. If calling COBOL on the i
6
EGL and Remote Programs on IBM i
Topic Sub-Topics: EGL Calls to Remote Programs (Overview) Calling programs on IBM i Invoking a command Invoking a procedure in a Service Program Dealing with members date fields on IBM i
7
Calling programs – Steps (Revisited)
Here’s what you need to do: One time step Add the iSeries JT400 toolkit to your project and Java Build Path Once per project Add an EGL Linkage Part for external programs Once for each program to call For each program add a callLink element For each call - Code the business logic to call the RPG Program, from an EGL “client” logic part: - Service - JSFHandler - Program - Library
8
Add the JT400 Toolkit to your Project
Calling RPG programs on an iSeries box requires the JT400 toolkit in your build path. There are 2 ways to do this (you only need to do one of these) 1. Add the file to the build path Right-click over your project and select Properties In the window that pops up, select Java Build Path on the left side of the screen Select Add External Jars… Find the jt400.jar file on your pc, select Open, Select OK to close the properties window. 2. Put the file in the WEB-INFLib folder. Switch to the Resource perspective Expand Web Content WEB-INF lib folder Drag jt400.jar into this folder Drag Here
9
Add to the Build File’s Linkage Option – 1 of 2
From Project Explorer, Open EGLWeb.eglbld using the EGL Build Parts Editor From the Window menu, open the Outline View Add a linkage part for the project From the externalPrograms part: Click: Add In the CallLink Elements: Name the program: RPG1 Type: remoteCall Enter the following properties: Alias: RPGCLSP1 conversionTable (type): CSOE037 Library: EGLPOT location (type): iseriesd.demos.ibm.com luwControl (select): SERVER remoteBind: GENERATION /runtime remoteComType (select): JAVA400 remotePgmType (select): STATELESS Close and Save your Linkage Options – and Close/Save the Build File Note: if you specify remotePgmType stateless or stateful you will not need QEGL on IBM i
10
Add to the Build File’s Linkage Option – 2 of 2
From Project Explorer, Right-Click over EGLWeb.eglbld and select: Open with Text editor Scroll down to the line <remoteCall pgmName=“RPG1”… Click your mouse at the beginning of the line (to set focus) Press Shift/End – to select the entire line (see reverse video line below) Press Ctrl/C – to copy the line Enter a new line, and press Ctrl/V 3 times – to copy/paste the entire line three times Modify the pgmName’s and Alias’ in the new lines to: RPG2 RPGCLSP2 RPG3 RPGCLSP3 RPG4 RPGZIPCK Close and save your edits Note that you may not have the <remoteCall… pgmName=“CBLCL..” entries, unless you have done the “Calling COBOL” workshop (prior section of this course)
11
2. Replicate the Linkage Options for Additional Programs – 3 of 3
Close and save your edits to the Linkage Options Open EGLWeb.eglbld with the EGL Build Parts Editor Un-check: Show only specified options From the linkage Option, open the drop-down list and select:externalPrograms Close and save your Build file Right-click over your EGLWeb project and Generate
12
3. EGL Program Calls to IBM i
So – you can see from this example, that there is nothing complex whatsoever about calling programs from EGL. This JSFHandler has several different scenarios: Passing individual parameters to RPG Passing a single record Passing a record that contains an array Here are the record definitions Fixed records are required Fixed arrays are required
13
EGL and Remote Programs on IBM i
Topic Sub-Topics: EGL Calls to Remote Programs (Overview) Calling programs on IBM i Invoking a command Invoking a procedure in a Service Program Dealing with date fields on IBM i members
14
Invoking IBM i comands – Steps
Here’s what you’ll do: The steps for invoking commands on IBM i is similar as for calling a program, but the linkage part needs to point to the QCMDEXC program. One time step - Add the iSeries JT400 toolkit to your project and Java Build Path For this step, follow the instructions for calling an RPG program Once in a project for external calls - Add an EGL Linkage Part for the QCMDEXC program For each call to QCMDEXC - Code the logic to add the command string as a parameter and to call the QCMDEXC Program, from an EGL “client” logic part: - Service - JSFHandler - Program - Library A invoke a IBM i command you need to call program QCMDEXC the rest is the same as a call to an RPG, CL, or COBOL program. The eglbld file will contain the info to invoke QCMDEXC when the call to COMMANDONI is done. The parameter contain the command info. You go thru the same steps, to create the linkage entry and do the Call in your EGL logic.
15
Add to the Build File’s Linkage Option
From Project Explorer, Open the .eglbld file using the EGL Build Parts Editor From the Window menu, open the Outline View (It should be located at the bottom left corner of the tool, next to “Page Data” View) From the Outline View, select “externalPrograms” (you should have created this during the calling Cobol workshop) From the externalPrograms part: Click: Add In the CallLink Elements: Name the program: COMANDONI Type: remoteCall Enter the following properties: Alias: QCMDEXC conversionTable (type): CSOE037 Library: %LIBL% location (type): iseriesd.demos.ibm.com luwControl (select): SERVER remoteBind: GENERATION remoteComType (select): JAVA400 remotePgmType (select): STATEFUL Close and Save your Linkage Options – and Close/Save the Build File The call will call COMANDONI but the linkage file contains the info that this call should invoke QCMDEXC the command to invoke is passed as a parameter. Make sure to not invoke commands that try to display a 5250 screen, you will get an exception.
16
EGL and Remote Programs on IBM i
Topic Sub-Topics: EGL Calls to Remote Programs (Overview) Calling programs on IBM i Invoking a command Invoking a procedure in a Service Program Dealing with members date fields on IBM i
17
Invoking a procedure in a Service Program – Steps
Here’s what you need to do: The steps for invoking procedures are different than for calling a program, no linkage part is need instead you will use a deployment descriptor instead. No Call statement is needed instead you invoke the procedure like a function, the procedure interface is described in an EGL interface. One time step - Add the iSeries JT400 toolkit to your project and Java Build Path Once for each procedure to invoke - Add an EGL deployment descriptor entry For each invocation - Code the business logic to call the RPG Program, from an EGL “client” logic part: - Service - Interface - JSFHandler - Program - Library A procedure invocation is very different from a call to a program. You go thru different steps, you need to create an entry in the deployment descriptor You will also need to create an EGL Interface that describes interface of the procedure
18
Add to the Service Client binding
From Project Explorer, in the EGLSource folder: Open the .egldd file using the EGL Build Parts Editor Select the Service Client Bindings Tab From the Service Bindings Configuration dialog Click the ADD button Select the Native binding Radio button On the Add Native Binding Dialog Enter the following attributes: conversionTable (type): CSOE037 Library: EGLPOT location (type): iseriesd.demos.ibm.com Userid(type): EGL4RPG Password(type): EGL4YOU Press the Finish button Close and Save your Deployment Descriptor –
19
4. Create the Interface for procedure invocation
Before finishing the project you need to create the EGL interface Right-click over the \EGLSource\ folder and select New Interface Package name: Interfaces EGL sourec file name: getdssol package Interfaces; import basicrecords.cstruc; // interface interface getdssol function getrecord(custnoi char(7),myds cstruc, fdback char(20)) ; end package basicrecords; //Put EGL Source File Contents Here record cstruc 10 custno char(7); 10 custna char(40); 10 repno char(5); 10 contac char(30); 10 cphone char(17); 10 cfax char(17); 10 caddr char(40); 10 ccity char(30); 10 ccount char(20); 10 czip char (10); 10 cziplo char(1); end
20
EGL and Remote Programs on IBM i
Topic Sub-Topics: EGL Calls to Remote Programs (Overview) Calling programs on IBM i Invoking a command Invoking a procedure in a Service Program Dealing with members date fields on IBM i
21
Accessing members in data base files
How to access members in data base files : Create an SQL Alias Use an SQL statement in your EGL Use SQL on i to create the alias Alias is an Sample use SQL Alias statement to create : CREATE ALIAS QLINK FOR WFLABXX/MYFILE(mymember) SQL name also works WFLABXX.MYFILE(mymember) Alias will show in RSE as well as OPS Navigator Use SQL Select statement with Alias name select * from WFLABXX/QLINK
22
Some notes for accessing DB2 on i
In the jdbc data source when working with yyyy Specify these properties: dateformat : iso timeformat: iso Setting a date to Assign in EGL = “01/01/0001” ; use Quotes Or assign NULL, to Null the date field One more: For working with the library list, use Naming: system package jsfhandlers; import com.ibm.egl.jsf.*; handler lookatmember type JSFHandler {onConstructionFunction = onConstruction, onPrerenderFunction = onPrerender, view = "lookatmember.jsp", viewRootVar = viewRoot} qdds Qddssrc[0]; memberalias string; membername string = "QDSIGNON2"; viewRoot UIViewRoot; // Function Declarations function onConstruction() end function onPrerender() function getNewMember() // Use prepare statement for ALIAS create to be able to use dynamic member name memberalias = "CREATE ALIAS QEGL.QLINK FOR QGPL.QDDSSRC(" + membername + ")"; prepare myAliasstmt FROM memberalias; // execute the prepared statement execute myAliasstmt; // run the SQL get qdds with #sql{ select * from QEGL.QLINK}; // Delete the alias execute #sql{drop QEGL.QLINK}; record Qddssrc type sqlRecord { tablenames=[["QEGL.QDDSSRC"]], keyItems=[SRCSEQ] } SRCSEQ DECIMAL(6, 2) ; SRCDAT DECIMAL(6, 0); SRCDTA CHAR(80);
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.