ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » IMS transaction down

Post new topic  Reply to topic Goto page Previous  1, 2
 IMS transaction down « View previous topic :: View next topic » 
Author Message
gidish
PostPosted: Thu Dec 27, 2007 7:16 am    Post subject: Reply with quote

Novice

Joined: 18 Jul 2007
Posts: 18

thank's for the holiday wishes , but i'm jewish (from israel)
we don't have holidays on Xmas..
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Dec 27, 2007 3:01 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Well in that case we'll just hope you had a happy Hannukah.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
LuisFer
PostPosted: Fri Dec 28, 2007 5:07 am    Post subject: Reply with quote

Partisan

Joined: 17 Aug 2002
Posts: 302

Don't finish the TxName with an asterisk.
Enjoy, please if mistake post it ,thanks
Code:

 /***---------------------------------------------------------------***/
 /* Software:       DISTRAN  - Send the IMS command /DIS TRAN <Tx> by */
 /*                 OTMA from MQ                                      */
 /*                 (c) Copyright Nacho/LuisFer                       */
 /*                                                                   */
 /* Estado:         Version 0 Release 0 Modificacion 0                */
 /* Modificado:     27 Diciembre 2007                                 */
 /*                                                                   */
 /* Autor:          Nacho/LuisFer                                     */
 /*                                                                   */
 /* Descripcion:    Send the IMS command /DIS TRAN <Tx> from MQ       */
 /*                                                                   */
 /* Note: This source is distributed "as is" without any Type of      */
 /*       warranty or support for their use.                          */
 /* Please, if you find this software useful a donation to            */
 /* The site which publishes and/or a ONG (legal) will be welcome     */
 /* Compilacion/LinkEdit                                              */
 /* Compilacion:                                                      */
 /* - Linux x86_32 MQ-v5.3.0.12                                       */
 /*    gcc -o <cargable> -lmqic -trigraphs <src>                      */
 /* - Linux x86_64 MQ-v6.0.2.2                                        */
 /*   C client application, 64-bit, non-threaded                      */
 /*   gcc -m64 -o <cargable> <src> -I/opt/mqm/inc -L/opt/mqm/lib64    */
 /*       -Wl,-rpath=/opt/mqm/lib64 -Wl,-rpath=/usr/lib64 -lmqic      */
 /*       -trigraphs                                                  */
 /*   C client application, 64-bit, threaded                          */ 
 /*   gcc -m64 -o <cargable> <src> -I/opt/mqm/inc -L/opt/mqm/lib64    */
 /*       -Wl,-rpath=/opt/mqm/lib64 -Wl,-rpath=/usr/lib64 -lmqic_r    */
 /*       -lpthread -trigraphs                                        */
 /*   C server application, 64-bit, non-threaded                      */
 /*   gcc -m64 -o <cargable> <src> -I/opt/mqm/inc -L/opt/mqm/lib64    */
 /*       -Wl,-rpath=/opt/mqm/lib64 -Wl,-rpath=/usr/lib64             */
 /*       -lmqm -trigraphs                                            */
 /*   C server application, 64-bit, threaded                          */
 /*   gcc -m64 -o <cargable> <src> -I/opt/mqm/inc -L/opt/mqm/lib64    */
 /*       -Wl,-rpath=/opt/mqm/lib64 -Wl,-rpath=/usr/lib64 -lmqm_r     */
 /*       -lpthread -trigraphs                                        */
 /***---------------------------------------------------------------***/
 /*** Change the define reqs to your instalation    */
#define _TANDEM
#if defined(__MVS__)
 #define MVS
 #undef  SUN
 #undef  LINUX
 #undef  TANDEM
#elif defined(_SUN)
 #define SUN
 #undef  MVS
 #undef  LINUX
 #undef  TANDEM
#elif defined(_LINUX)
 #undef  SUN
 #undef  MVS
 #define LINUX
 #undef  TANDEM
#elif defined(_TANDEM)
 #undef  SUN
 #undef  MVS
 #undef  LINUX
 #define TANDEM
#else
 #error ERR:26985 Platform dont probed
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <sys/times.h>
#include <ctype.h>
#include <sys/types.h>
#include <unistd.h>

#if defined(MVS)   
 #include <spc.h>   
#endif


#include <cmqc.h>      /*MQSeries */
#include <cmqxc.h>     /*MQSeries */

/***Define reqs change please       */
#define COLAIN  "Your_OTMA_MQQueue"
#define COLAOU  "Your_Reply_Queue"
#define LTERM   "Your_IMS_LTERM"
#define SVRCONN "Your_SVRCONN"
#define passw   "Your_MainFrame_User_Password"
#define user    "Your_MainFrame_User"
#define CONNAME "Your_MQ_DNS_TCP_IP"

void Conectar(void);
void DesConectar(void);
void Enviar(void);

/***Conversion ASCII_EBCDIC*/
static MQBYTE JC_ascii_ebcdic??( ??) =
{
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*0*/
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*1*/
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x40,0x4f,0x7f,0xb1,0x5b,0x6c,0x50,0x7d, /*2*/
 0x4d,0x5d,0x5c,0x4e,0x6b,0x60,0x4b,0x61,
 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7, /*3*/
 0xf8,0xf9,0x7a,0x5e,0x4c,0x7e,0x6e,0x6f,
 0x44,0xc1,0xc2,0xc3,0xc4,0xc5,0xc6,0xc7, /*4*/
 0xc8,0xc9,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,
 0xd7,0xd8,0xd9,0xe2,0xe3,0xe4,0xe5,0xe6, /*5*/
 0xe7,0xe8,0xe9,0x90,0x48,0xb5,0x5f,0x6d,
 0xa0,0x81,0x82,0x83,0x84,0x85,0x86,0x87, /*6*/
 0x88,0x89,0x91,0x92,0x93,0x94,0x95,0x96,
 0x97,0x98,0x99,0xa2,0xa3,0xa4,0xa5,0xa6, /*7*/
 0xa7,0xa8,0xa9,0x51,0xbb,0x54,0xbd,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*8*/
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*9*/
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x6a,0x7b,0x00,0x00, /*a*/
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*b*/
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*c*/
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x7b,0x00,0x00,0x00,0x00,0x00,0x00, /*d*/
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*e*/
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
 0x00,0x6a,0x00,0x00,0x00,0x00,0x00,0x00, /*f*/
 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
/***Conversion EBCDIC_ASCII*/
static MQBYTE JC_ebcdic_ascii??( ??) =
{
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*0*/
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*1*/
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*2*/
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*3*/
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x20,0x00,0x00,0x00,0x40,0x00,0x00,0x00, /*4*/
  0x5c,0x00,0x00,0x2e,0x3c,0x28,0x2b,0x21,
  0x26,0x7b,0x00,0x00,0x7d,0x00,0x00,0x00, /*5*/
  0x00,0x00,0x00,0x24,0x2a,0x29,0x3b,0x5e,
  0x2d,0x2f,0x00,0x00,0x00,0x00,0x00,0x00, /*6*/
  0x00,0x00,0xf1,0x2c,0x25,0x5f,0x3e,0x3f,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /*7*/
  0x00,0x00,0x3a,0xd1,0x00,0x27,0x3d,0x22,
  0x00,0x61,0x62,0x63,0x64,0x65,0x66,0x67, /*8*/
  0x68,0x69,0x00,0x00,0x00,0x00,0x00,0x00,
  0x5b,0x6a,0x6b,0x6c,0x6d,0x6e,0x6f,0x70, /*9*/
  0x71,0x72,0x00,0x00,0x00,0x00,0x00,0x00,
  0x60,0x00,0x73,0x74,0x75,0x76,0x77,0x78, /*a*/
  0x79,0x7a,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x23,0x00,0x00,0x00,0x5d,0x00,0x00, /*b*/
  0x00,0x00,0x00,0x7c,0x00,0x7e,0x00,0x00,
  0x00,0x41,0x42,0x43,0x44,0x45,0x46,0x47, /*c*/
  0x48,0x49,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x4a,0x4b,0x4c,0x4d,0x4e,0x4f,0x50, /*d*/
  0x51,0x52,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x53,0x54,0x55,0x56,0x57,0x58, /*e*/
  0x59,0x5a,0x00,0x00,0x00,0x00,0x00,0x00,
  0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37, /*f*/
  0x38,0x39,0x00,0x00,0x00,0x00,0x00,0x00
};

MQOD    odp = {MQOD_DEFAULT};    /* Object Descriptor     */
MQOD    odg = {MQOD_DEFAULT};    /* Object Descriptor     */
MQMD    mdp = {MQMD_DEFAULT};    /* Message Descriptor PUT*/
MQMD    mdg = {MQMD_DEFAULT};    /* Message Descriptor GET*/
MQPMO   pmo = {MQPMO_DEFAULT};   /* PMO                   */
MQGMO   gmo = {MQGMO_DEFAULT};   /* GMO                   */
MQIIH   iih = {MQIIH_DEFAULT};   /* IIH                   */
MQCNO   cno = {MQCNO_DEFAULT};   /* MQCONNX-CNO           */
MQCD    cd  = {MQCD_CLIENT_CONN_DEFAULT};   /*MQCONNX-CD  */

MQHCONN  Hcon;                    /* connection handle    */
MQHOBJ   HobjPut;                 /* object handle PUT    */
MQHOBJ   HobjGet;                 /* object handle GET    */
MQLONG   O_options_p;             /* MQOPEN options PUT   */
MQLONG   O_options_g;             /* MQOPEN options GET   */
MQLONG   C_options;               /* MQCLOSE options      */
MQLONG   CompCode;                /* completion code      */
MQLONG   Reason;                  /* reason code          */

MQLONG   i=0;                     /* Contador             */

MQLONG   CReason= 0;              /* reason code-devuelto */
MQLONG   buflen    = 0;           /* buffer length        */
MQBYTE   buffer[350]="\x0";       /* message buffer       */

char     QMName[49]=" ";          /* QMgr Name            */

MQBYTE   *pData1=NULL;            /* Conversion de Arrays */
MQBYTE   IMSCMD[109]="\x0";       /* Construccion  en Hex */
MQBYTE   TxName[10] ="\x0";       /* Nombre Tx + " ."     */
MQBYTE   punto[2] = {0x40,0x4B,};
MQLONG   DataLen;                 /* Long de Mensaje  MQGET */

/*llzz/DIS TRAN    in Hex */

MQBYTE   IMSCMD1[14] = {
         0x00,0x19,0x00,0x00,0x61,0xC4,0xC9,0xE2,
         0x40,0xE3,0xD9,0xC1,0xD5,0x40,
                       };
int ESTTXIMS=0;
char Estado[3]="\x0";
char Txcod [9]="\x0";

struct tms    bt1,bt2,bt3,bt4,bt5,bt41;
clock_t       t1,t2,t3,t4,t5,t41 ;
struct tms    iConnx,iOpenG,iOpenP,fConnx,fOpenG,fOpenP;
struct tms    iDisc,iCloseG,iCloseP,fDisc,fCloseG,fCloseP;
int           TPS=0;               /*Ciclos de la cpu*/
time_t  lt;


int main(int argc, char **argv)
{
 if (argc < 2)
 {
  printf("ERR:26985 TxName?\n");
  exit(0);
 }
 t1 = times(&bt1);
 TPS = sysconf(_SC_CLK_TCK);    /*obtengo los ciclos de cpu*/

 strncpy(TxName, argv[1],(long)strlen(argv[1]));     
 strncpy(Txcod,  argv[1],(long)strlen(argv[1]));   
 for (i=0;i<=(long)strlen(TxName);i++)
 {
  TxName[i]= toupper(TxName[i]);
 }
 pData1 = (MQBYTE *)TxName;

 #if !defined(MVS)
 for (i=0;i<=(long)strlen(TxName);i++)
 {
  TxName[i]=(MQBYTE)JC_ascii_ebcdic??(*pData1??);
  pData1++;
 }
 #endif
 strcat(TxName,punto);

 Conectar();

 Enviar();

 DesConectar();

 if (ESTTXIMS == 0)
 {
  sprintf(Estado,"OK");
 }
 else
 {
  sprintf(Estado,"KO");
 }

 t2 = times(&bt2);
 

 printf("TxName:%.8s Status:%.2s RC:%i QMgr:%.4s Elapsed=%.2fs CPUTIME=%.2fs\n",\
         Txcod,\
         Estado,\
         ESTTXIMS,\
         mdg.ReplyToQMgr,\
        (float)(t2 - t1)/(float)TPS,\
        (float)(bt2.tms_utime - bt1.tms_utime)/(float)TPS);

 return (ESTTXIMS);
}

 /***********/
void Enviar()
{

 char* STOP ="STOP";
 char* LOCK ="LOCK";
 char* PSTO ="PSTO";
 char* PURG ="PURG";
 char* QERR ="QERR";
 char* SPND ="SPND";
 char* USTO ="USTO";


 memcpy(IMSCMD,&iih,sizeof(iih));
 memcpy(IMSCMD+sizeof(iih),IMSCMD1,sizeof(IMSCMD1));
 memcpy(IMSCMD+sizeof(iih)+sizeof(IMSCMD1),TxName,sizeof(TxName));
 
 t4 = times(&bt4);

 MQPUT(Hcon,             /* connection handle               */
       HobjPut,          /* object handle                   */
       &mdp,             /* message descriptor              */
       &pmo,             /* Put Mensaje Options             */
       sizeof(IMSCMD),   /* buffer length                   */
       IMSCMD,           /* message buffer                  */
       &CompCode,        /* completion code                 */
       &Reason);         /* reason code                     */


 if (Reason != 0)
 {
  printf("ERR:%i rcMQPut\n",Reason);
  DesConectar();
  exit(0);
 }
 /*MsgId a Correl*/
 memcpy(mdg.CorrelId, mdp.MsgId, sizeof(mdg.CorrelId));
 
 MQGET(Hcon,
       HobjGet,
       &mdg,
       &gmo,
       sizeof(buffer),
       buffer,
       &DataLen,
       &CompCode,
       &Reason);


 t5 = times(&bt5);

 if (Reason == 2079) {Reason=0;} 

 for (i=0;i<DataLen;i++)
 {
  if (isprint(buffer[i]) == 0)
  {
   buffer[i] = ' ';
  }
 } 

 if (
     (strstr(buffer,STOP)!= NULL) |
     (strstr(buffer,LOCK)!= NULL) |
     (strstr(buffer,PSTO)!= NULL) |
     (strstr(buffer,PURG)!= NULL) |
     (strstr(buffer,QERR)!= NULL) |
     (strstr(buffer,SPND)!= NULL) |
     (strstr(buffer,USTO)!= NULL)
    )
 {
  ESTTXIMS = 1;
 }


}

/********/
void Conectar()
{

 strncpy(cd.ChannelName,SVRCONN,MQ_CHANNEL_NAME_LENGTH);
 strncpy(cd.ConnectionName,CONNAME,MQ_CONN_NAME_LENGTH);
 cno.Version = MQCNO_VERSION_2;
 cno.ClientConnPtr = &cd;

 MQCONNX(QMName,
         &cno,
         &Hcon,
         &CompCode,
         &Reason);
 if (Reason != 0)
 {
  printf("ERR:%i rcMQCONNX\n",Reason);
  DesConectar();
  exit(1);
 }

 strncpy(odp.ObjectName,COLAIN, (size_t)MQ_Q_NAME_LENGTH);
 strncpy(odg.ObjectName,COLAOU, (size_t)MQ_Q_NAME_LENGTH);

 mdp.Expiry  = 500; /*5 segundos de Expiracion PUT */
 mdp.MsgType = MQMT_REQUEST;
 mdp.Report  = MQRO_EXCEPTION_WITH_DATA;
 memcpy(mdp.Format,MQFMT_IMS,sizeof(mdp.Format));
 memcpy(mdp.ReplyToQ,odg.ObjectName,sizeof(mdp.ReplyToQ));
 memcpy(mdp.ReplyToQMgr,QMName,sizeof(mdp.ReplyToQMgr));
 strncpy(mdp.UserIdentifier,user,(long)strlen(user));

 iih.Version = MQIIH_CURRENT_VERSION;
 iih.StrucLength  = 0x00000054;
 iih.CommitMode   = MQICM_SEND_THEN_COMMIT;
 iih.Flags = 0x00000001;
 memcpy(iih.ReplyToFormat,MQFMT_STRING,sizeof(iih.ReplyToFormat));
 memcpy(iih.Authenticator,passw,sizeof(iih.Authenticator));
 memcpy(iih.LTermOverride,LTERM,sizeof(iih.LTermOverride));
 memcpy(iih.ReplyToFormat,MQFMT_STRING,sizeof(iih.ReplyToFormat));

 C_options = 0;

 O_options_p= MQOO_OUTPUT              +
              MQOO_FAIL_IF_QUIESCING   +
              MQOO_BIND_AS_Q_DEF       +
              MQOO_SET_IDENTITY_CONTEXT;

 O_options_g= MQOO_FAIL_IF_QUIESCING   +
              MQOO_INPUT_SHARED        +
              MQOO_BIND_AS_Q_DEF;

 pmo.Options =  MQPMO_NO_SYNCPOINT      +
                MQPMO_FAIL_IF_QUIESCING +
                MQPMO_SET_IDENTITY_CONTEXT;

 gmo.Options =  MQGMO_NO_SYNCPOINT      +
                MQGMO_FAIL_IF_QUIESCING +
                MQGMO_CONVERT           +   
                MQGMO_ACCEPT_TRUNCATED_MSG +
                MQGMO_WAIT;
 gmo.WaitInterval = 1000; /*Espero 01.0 Segundos por la Respuesta  */

 MQOPEN(Hcon,             /* connection handle            */
        &odp,             /* object descriptor for queue  */
        O_options_p,      /* open options                 */
        &HobjPut,         /* object handle                */
        &CompCode,        /* MQOPEN completion code       */
        &Reason);         /* reason code                  */
 if (Reason != 0)
 {
  printf("ERR:%i rcMQOpen_Put\n",Reason);
  DesConectar();
  exit(1);
 }

 MQOPEN(Hcon,             /* connection handle            */
        &odg,             /* object descriptor for queue  */
        O_options_g,      /* open options                 */
        &HobjGet,         /* object handle                */
        &CompCode,        /* MQOPEN completion code       */
        &Reason);         /* reason code                  */
 if (Reason != 0)
 {
  printf("ERR:%i rcMQOpen_Get\n",Reason);
  DesConectar();
  exit(1);
 }
}
/********/
void DesConectar()
{
 MQCLOSE(Hcon,
         &HobjPut,
         C_options,
         &CompCode,
         &Reason);

 MQCLOSE(Hcon,
         &HobjGet,
         C_options,
         &CompCode,
         &Reason);

 MQDISC(&Hcon,
        &CompCode,
        &Reason);
}
Back to top
View user's profile Send private message
gidish
PostPosted: Mon Dec 31, 2007 12:15 am    Post subject: Reply with quote

Novice

Joined: 18 Jul 2007
Posts: 18

thank's luis !

and thank's to all for your help.

happy new year !

Gidi.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page Previous  1, 2 Page 2 of 2

MQSeries.net Forum Index » General IBM MQ Support » IMS transaction down
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.