Using business developer, EGL based applications are developed and configured to connect with queue managers running on host side. The queue managers contain message queues which enables the programs or applications to communicate with one another. The applications can open, put messages, get messages, and close the queue. A program puts the message into the queue and another program can get that message. Message retrieval in MQ will occur on FIFO (First in First out) basis.
This blog explains the steps for creation of queue manager and queues in iSeries, configuration in business developer to add/get messages from queues in iSeries environment.
Creating Queue manager and queues in iSeries:
Queue manager handles all the queues and its dependent resources. To create a queue manager in iSeries, give ‘CRTMQM’ command in command line and hit ‘Enter’. ‘Create message queue manager’ panel will appear.
To create queues, give ‘CRTMQMQ’ command in command line.
These queue manager and queues which are created, can be viewed in iSeries environment as below.
There will be both users created queues and system default queues within the queue manager as seen in above screenshot. The user created queues can be accessed by programs in business developer.
EGL code in business developer:
A new EGL project should be created by selecting EGL project on File à New in the menu bar. The target runtime for the project should be Cobol. Then, create a package and a program within that project.
Within the program, develop a code to add a message to the queue and get the message from the queue using ‘add’ and ‘get next’ keywords in EGL. For example,
Create an EGL record with type ‘MQRecord’ and a record variable to access the queue in iSeries.
MQ configuration in business developer:
Build descriptor files in EGL projects are used for code generation purpose. It is invoked to generate the EGL code into either Java or COBOL code depending on the target system. Here, the program is converted to Cobol code since the target system is iSeries.
After creating EGL programs in business developer, the build descriptor should be configured with MQ details in host side. The .eglbld file will be present within the EGL project. In the outline view, two build options file will be seen.
A resource association part is created in the build descriptor file by following the below steps.
- Right click the .eglbld file in outline view -> Add Part.
- Select the ‘Resource Association’ option and provide a name. Then, click on ‘Finish’.
The resource association part will be seen in outline view and opened in editor. Add an association in resource association file and provide the details of MQ manager and queue details in iSeries as mentioned below.
This resource association part enables the EGL program in business developer to get connected with the queue in iSeries environment. So, the resource association part name should be selected in Cobol build options.
Preferably, ‘COBOLBuildOptions’ file can be configured as seen below, with host details like hostname, user ID, password etc.
Execution of COBOL code:
The program in business developer is generated using Cobol build options in .eglbld file. The EGL code is generated successfully, and the generated COBOL code can be seen in the path mentioned in genDirectory.
To execute the generated code in iSeries, ‘CALL program_name’ command is used in command line.
After executing the program, the message is added to the queue in queue manager. To view the message in queue, navigate into the queue manager and give 12 besides the respective queue name. A message entry is seen as below.
Give option 8 to display data within the queue.
If the program is coded for get next, the message from the queue is retrieved and displayed in the spool. To verify it, the program is generated using the same build options as above and called in iSeries.
The message will get deleted from the queue when it is retrieved as seen below.
In this way, the message queues in iSeries are accessed to add and get messages from Business Developer. Hence, these type of message queues can transport any type of data and it provides a communication layer to control the flow of messages. This versatile way of messaging is security rich and high performance of delivering data.