Displaying Data Queue Information

I am currently developing some code which requires the use use of DDM Data Queues, I was having problems because the data was not flowing between the Data Queues and I needed to see what was going on. After trying to find OS commands which would display the Data Queue information and having turned up nothing, I decided to write my own simple command which would display the detail out to a screen. The programs are very basic as I just needed to debug the process with them, if you need to put them into production I would suggest you improve the error checking etc to ensure the messages such as the Data Queue Doesnt exist, or the format used is incorrect are handled. For more information on the API used please see the documentation.

Here is the command which is fronting the program

/*===================================================================*/
/* Command name : DSPDQINF */
/* Author name..: Chris Hird */
/* Date created : Aug 30,2007 */
/* */
/* Purpose......: Display Data Queue Information */
/* CPP..........: DSPDQINF */
/* Revision log.: */
/* Date Author Revision */
/* */
/*===================================================================*/

CMD PROMPT(‘Display Data Queue Information’)
PARM KWD( DTAQ ) +
TYPE( QUAL1 ) +
MIN( 1 ) +
PROMPT(‘Data queue’)
PARM KWD(TYPE) TYPE(*CHAR) LEN(4) RSTD(*YES) +
DFT(*STD) VALUES(*STD *DDM) PROMPT(‘Data +
Queue Type’)

QUAL1: QUAL TYPE(*NAME) +
LEN(10)
QUAL TYPE(*NAME) +
LEN(10) +
DFT(*LIBL) +
SPCVAL((*LIBL)) +
PROMPT(‘Library name:’)

Here is the program which processes the request

#include                           /* standard I/O */
#include                          /* standard I/O */
#include                           /* Record I/O */
#include                          /* memory and string*/
#include                        /* Data Queue*/

int main(int argc, char** argv) {
int Inf_Len;                                /* Info Len */
Qmh_Qrdqd_RDQD0200_t Info;                  /* DQ Info */
Qmh_Qrdqd_RDQD0100_t Info1;                 /* DQ Info */

Inf_Len = sizeof(Info);
if(memcmp(argv[2],"*DDM",4) == 0) {
   Inf_Len = sizeof(Info);
   QMHQRDQD(&Info,
            Inf_Len,
            "RDQD0200",
            argv[1]);

   printf("APPC Device = %.10sn",Info.APPC_Device);
   printf("Mode = %.8sn",Info.Mode);
   printf("Remote Location = %.8sn",Info.Remote_Location);
   printf("Local Location = %.8sn",Info.Local_Location);
   printf("Remote Network ID = %.8sn",Info.Remote_Network_ID);
   printf("Remote Data Queue Name = %.10sn",Info.Remote_Data_Queue_Name);
   printf("Remote Data Queue Lib = %.10sn",Info.Remote_Data_Queue_Library);
   printf("Data Queue Name = %.10sn",Info.Data_Queue_Name);
   printf("Data Queue Lib = %.10sn",Info.Data_Queue_Library);
   printf("Relational DB Entry = %.10sn",Info.Relational_Database);
   }
else {
   Inf_Len = sizeof(Info1);
   QMHQRDQD(&Info1,
            Inf_Len,
            "RDQD0100",
            argv[1]);
   printf("Message length = %dn",Info1.Message_Length);
   printf("Key length = %dn",Info1.Key_Length);
   printf("Sequence = %cn",Info1.Sequence);
   printf("Include Sender ID = %cn",Info1.Include_Sender_Id);
   printf("Force Indicators = %cn",Info1.Force_Indicators);
   printf("Text = %.50sn",Info1.Text);
   printf("Type = %cn",Info1.Type);
   printf("Auto Reclaim = %cn",Info1.Automatic_Reclaim);
   printf("Num Messages = %dn",Info1.Number_Messages);
   printf("Max Messages = %dn",Info1.Max_Number_Messages);
   printf("Name = %.10sn",Info1.Data_Queue_Name);
   printf("Library = %.10sn",Info1.Data_Queue_Library);
   printf("Max Entries = %dn",Info1.Max_Number_Entries_Allowed);
   printf("Initial Entries = %dn",Info1.Initial_Number_Entries);
   printf("Max Entries Specified = %dn",Info1.Max_Number_Entries_Specified);
   }
return 1;
}

The output should be similar to the following for a DDM Data Queue

APPC Device =
Mode =
Remote Location = *RDB
Local Location =
Remote Network ID =
Remote Data Queue Name = AUDITQ
Remote Data Queue Lib = RAPTST
Data Queue Name = DDMAUDITQ
Data Queue Lib = RAPTST
Relational DB Entry = SHIELD2

And for a Standard Data Queue


Message length = 256
Key length = 0
Sequence =
Include Sender ID =
Force Indicators =
Text =
Type =
Auto Reclaim =
Num Messages = 0
Max Messages = 16
Name = AUDITQ
Library = RAPTST
Max Entries = 52368
Initial Entries = 16
Max Entries Specified = -1

If you need to understand the details of the output the descriptions provided in the documentation will give you a good idea.

Hope this is again useful?

Chris…

3 thoughts on “Displaying Data Queue Information”

  1. One thing which struck me was the parameter passed *STD or *DDM can be misleading, you can display the *STD detail for a DDM Data Queue! But you cannot display the DDM information for a *STD Data Queue…

    Chris…

  2. The formatter seems to remove the from the code! I dont know why its doing it but its a real pain! I will try to fix it up but just in case I cant be aware the code does need some adjustment.

    Chris…

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.