Topic
  • 5 replies
  • Latest Post - ‏2014-04-09T22:44:43Z by markevans
rchau
rchau
12 Posts

Pinned topic Sample for RDB 8.0.1.3 Java Program calling MQ

‏2014-03-19T00:03:32Z |

Hi,

 

Does anyone have a sample of a Java RDB (version  8.0.1.3)  program calling MQ ?

 

Thanks

  • markevans
    markevans
    2811 Posts

    Re: Sample for RDB 8.0.1.3 Java Program calling MQ

    ‏2014-03-19T15:01:25Z  

    Hi,

    I don't have a specific example, but can you use the information in the EGL programmer's guide to understand what is needed.

    http://pic.dhe.ibm.com/infocenter/rbdhelp/v8r5m0/topic/com.ibm.egl.pg.doc/topics/pegl_mq_overview_cpt.html

    Essentially, in EGL we treat an MQ Queue as a record. 

    So you define a record of type MQRecord and then you "add" or "get" this record (like other EGL record types).   The resource association defines what queue manager/queue name to use.  There are also advanced options which are explained in the helps.

  • rchau
    rchau
    12 Posts

    Re: Sample for RDB 8.0.1.3 Java Program calling MQ

    ‏2014-03-19T23:22:07Z  
    • markevans
    • ‏2014-03-19T15:01:25Z

    Hi,

    I don't have a specific example, but can you use the information in the EGL programmer's guide to understand what is needed.

    http://pic.dhe.ibm.com/infocenter/rbdhelp/v8r5m0/topic/com.ibm.egl.pg.doc/topics/pegl_mq_overview_cpt.html

    Essentially, in EGL we treat an MQ Queue as a record. 

    So you define a record of type MQRecord and then you "add" or "get" this record (like other EGL record types).   The resource association defines what queue manager/queue name to use.  There are also advanced options which are explained in the helps.

    Thanks for the Reply Mark,

    But I don't understand how to set the resource association.

    Every time I've created it, it has shown an error. In the EGL generation guide it states that the resource association mq file types are not support with Java. 

    systemName for Java

    Java programs only support the fileType seqws. The systemName is the path to the file. The EGL debugger, when running on Windows (but not Linux), also supports the fileTypeibmcobol. In this case the systemName is a UNC (Universal Naming Convention) path to the file.

  • markevans
    markevans
    2811 Posts

    Re: Sample for RDB 8.0.1.3 Java Program calling MQ

    ‏2014-03-20T02:47:05Z  
    • rchau
    • ‏2014-03-19T23:22:07Z

    Thanks for the Reply Mark,

    But I don't understand how to set the resource association.

    Every time I've created it, it has shown an error. In the EGL generation guide it states that the resource association mq file types are not support with Java. 

    systemName for Java

    Java programs only support the fileType seqws. The systemName is the path to the file. The EGL debugger, when running on Windows (but not Linux), also supports the fileTypeibmcobol. In this case the systemName is a UNC (Universal Naming Convention) path to the file.

    Hi,

    You need to click the pull down under filetype.   Among the choices is "mq".  See the screen shot attached.

    This is the text I found in the 8.0.1 helps.  So this shows that the systemName meaning changes depending on the filetype including for MQ:

    http://pic.dhe.ibm.com/infocenter/rbdhelp/v8r0m0/topic/com.ibm.egl.gg.doc/topics/gegl_core_associationelements.html

    There is one table in the helps but that is really for records defined as serial, indexed, relative or print forms. This is not the same as "mq". 

     

    Text for what systemName can be.

    systemName for Windows

    When the system property is set to win, the following values are available for the fileType property:
    ibmcobol
    The value of the systemName property is the name of a remote VSAM file that is associated with an EGL serial, indexed, or relative record. The remote VSAM file must be located on z/OS. The file name must be in the following format:
    
    \\
    machineName\
    qualifier.fileName
    
    machineName
    The SNA LU alias name as specified in the SNA configuration.
    qualifier.fileName
    The VSAM data set name, including a qualifier.
    mq
    The value of the systemName property is the name of an WebSphere MQ message queue associated with an EGL MQRecord. The default value is the EGL queue name. The value of systemName is in the form of either queueName or queueManagerName:queueName. If the systemName is queueName, EGL connects to the default queue manager.
    seqws
    The value of the systemName property is the name of a file that is associated with an EGL serial record.

     

    Attachments

  • rchau
    rchau
    12 Posts

    Re: Sample for RDB 8.0.1.3 Java Program calling MQ

    ‏2014-04-03T23:49:58Z  
    • rchau
    • ‏2014-03-19T23:22:07Z

    Thanks for the Reply Mark,

    But I don't understand how to set the resource association.

    Every time I've created it, it has shown an error. In the EGL generation guide it states that the resource association mq file types are not support with Java. 

    systemName for Java

    Java programs only support the fileType seqws. The systemName is the path to the file. The EGL debugger, when running on Windows (but not Linux), also supports the fileTypeibmcobol. In this case the systemName is a UNC (Universal Naming Convention) path to the file.

    Hi Mark,

    What I'm trying to do is send a MQ message from Windows to the mainframe.

    But I seem to be missing the part that MQ connects to the server (which is on the Mainframe)

    My code is below

     

        TestQueuePut MQPUT;

        TestQueueGet MQGET;
     
        // Variable Declarations
        variableName string;
        
        function main()    
            TestVariable char(10); // just a variable 
            TestQueuePut.message = "Message to be added on Q1";
            add TestQueuePut; // this will insert a message to the queue 
            close TestQueuePut; // invokes MQ MQCLOSE needs since will read next 
            set TestQueueGet empty; // empties the message 
            get next TestQueueGet; // read MQ queue if there is no messages 
            if(TestQueueGet is endOfFile) // if there is no messages return EOF indicator 
                move "No messages" to TestVariable;
            end
     
        end
     

    Thanks in advance

    Attachments

  • markevans
    markevans
    2811 Posts

    Re: Sample for RDB 8.0.1.3 Java Program calling MQ

    ‏2014-04-09T22:44:43Z  
    • rchau
    • ‏2014-04-03T23:49:58Z

    Hi Mark,

    What I'm trying to do is send a MQ message from Windows to the mainframe.

    But I seem to be missing the part that MQ connects to the server (which is on the Mainframe)

    My code is below

     

        TestQueuePut MQPUT;

        TestQueueGet MQGET;
     
        // Variable Declarations
        variableName string;
        
        function main()    
            TestVariable char(10); // just a variable 
            TestQueuePut.message = "Message to be added on Q1";
            add TestQueuePut; // this will insert a message to the queue 
            close TestQueuePut; // invokes MQ MQCLOSE needs since will read next 
            set TestQueueGet empty; // empties the message 
            get next TestQueueGet; // read MQ queue if there is no messages 
            if(TestQueueGet is endOfFile) // if there is no messages return EOF indicator 
                move "No messages" to TestVariable;
            end
     
        end
     

    Thanks in advance

    sorry for the delay in replying....

    Two points that may resolve for you.

    a.) You can use one MQ record if you want them to go to the same queue.  They do not have to be separate records...and then you can just use one resource association entry.

    b.) To add a queue manager, you add it to the "systemName" in the resource association entry.

    From the EGL helps (Defining resource associations for message queues ), here is info on the systemName and if you need to specify a conversion table name (mainframe is EBCDIC)

    1. For each file name and system on the left side of the editor, you can specify properties on the right side. The system and file type carry over from the left side. Specify the system resource name (systemName property) in the following form:
      
      [
      queueManagerName:]
      queueName
      

      Specify only the queueName if you want to use the default queue manager. The system resource name for message queue records defines the queue manager name and queue name. The system resource name is used as the initial value for the fileName property for the MQRecord and identifies the default queue associated with the record.

      EGL uses the system resource name in add and get next statements for the message queue record. The queueName identifies the queue that is accessed by the operation. The queueManagerName identifies the queue manager on which the queue is defined. The default queue manager is the queue manager to which the program is connected. If there is not already an active connection, EGL uses the queue manager name to connect to the queue manager before accessing the queue. If no queue manager name is specified, EGL connects to the default queue manager for the system. If the system resource name is not specified in a resource association file, a default system resource name is defined by the fileName property of the message queue record.

    2. You can optionally specify a conversion table if you want data format conversion to be performed on the message. If you specify a conversion table, EGL converts the message from local format to remote format when the message is added to the queue, and from remote format to local format when the message is read from the queue. EGL performs conversion using the message queue record structure to identify the data type of fields in the message.

    You may also want to look at the section Connecting to Websphere MQ over TCP/IP   Without this technique, I believe you have to have some form of MQ installed on the windows machine to define the queue manager and where the queue you are writing to is actually located.

     

    Hope this helps.

     

    Mark