Hi Jim,

Thanks for your help.:-) I made the following changes and the code works
better.

MQS_API       INT32 MQGet (DP_MPTR INT32 QMgr, INT32 QNum, INT32 MsgMax,
INT32 WaitPeriod, VAR * Message)

...

*MQBYTE   buff[MsgMax];          //Added Code part*

*// STRING_RESIZE_VBI(Message, MsgMax);  Commented*

...

MQGET(QManagers[QMgr].QMHeader.HQMcon                           ,

      QManagers[QMgr].Queues[QNum].QHandle                 ,

      &MDescriptor                                                       ,

      &GetOptions                                                         ,


      MsgMax
,

*      buff
                                                                 ,*

     (PMQLONG)&MsgLen                                                    ,

     &QManagers[QMgr].Queues[QNum].CompletionCode   ,

     &QManagers[QMgr].Queues[QNum].ReasonCode

     );

SetMQFail(DP_MPRM 0);

*buff[MsgLen] = '\0';                        **//Added Code part*

*(char *)Message = &buff;               **//Added Code part*

*// STRING_RESIZE_VBI(Message, MsgLen);   Commented*

return   MsgLen;


Now am able to get the message in *Var MESSAGE *without facing any trap
errors*. *Now am having problem in getting the message value in the BASIC
program that called this function. What i have is a Basic program that calls
this function with the functions argument. And am expecting to get the value
of Message from the argument passed. Is there any more coding that needs to
be done? Thanks in advance for the help.

Bensly

On Wed, May 18, 2011 at 9:18 PM, Jim Idle <[email protected]> wrote:

> So you are overwritng memory that you have not allocated or not allocated
> at the correct size or are using an incorrect pointer, which is what I said
> originally. You are doing an MQGET and passing the address of the VAR struct
> and not its pointer to the string buffer for a start.
>
>
>
> Jim
>
>
>
> *From:* [email protected] [mailto:[email protected]] *On Behalf
> Of *Bensly Trying Harder:-(
> *Sent:* Tuesday, May 17, 2011 9:39 PM
>
> *To:* [email protected]
> *Subject:* Re: T24: Error Trap 2 faced while STRING_RESIZE_VBI is
> executed.
>
>
>
> Hi Pat
>
>
>
> If the problem is with the 'Message VAR' not having been initialized, the
> TRAP error 2 should have been thrown the first time i use *
> STRING_RESIZE_VBI* right? I have analysed further and found that the
> problem may not be with STRING_RESIZE_VBI. Am facing the error after the MQ
> function MQGET has been called. I face the same error if i am using some
> other JBASE functions apart from *STRING_RESIZE_VBI* like *STORE_VBS(Message 
> (STRING
> *)"")* also.
>
>
>
> The following is the part of code in the C function.
>
> MQS_API       INT32 MQGet (DP_MPTR INT32 QMgr, INT32 QNum, INT32 MsgMax,
> INT32 WaitPeriod, VAR * Message)
>
> ...
>
> STRING_RESIZE_VBI(Message, MsgMax);
>
> ...
>
> MQGET(QManagers[QMgr].QMHeader.HQMcon                           ,
>
>       QManagers[QMgr].Queues[QNum].QHandle                 ,
>
>       &MDescriptor                                                       ,
>
>       &GetOptions
> ,
>
>       MsgMax
>                                                 ,
>
>       Message
> ,
>
>      (PMQLONG)&MsgLen                                                    ,
>
>      &QManagers[QMgr].Queues[QNum].CompletionCode   ,
>
>      &QManagers[QMgr].Queues[QNum].ReasonCode
>
>      );
>
> SetMQFail(DP_MPRM 0);
>
> *STRING_RESIZE_VBI(Message, MsgLen);*
>
> return   MsgLen;
>
>
>
> In the above code part '...' signifies coding have been done related to
> MQGET, but not of VAR Message.
>
>
>
>
>
> Bensly
>
>
>
>
>
> On Wed, May 18, 2011 at 6:22 AM, pat <[email protected]> wrote:
>
> My guess is the the 'Message VAR' has not been initialised, or has
> been 'overwritten', prior to 'RESIZING'
>
> The 'Fatal error at trap location 2' occurs when attempting to
> ( incorrectly ) 'manipulate' a 'File VARiable'
>
> Can you post the C code for the function in which you are using the
> 'STRING_RESIZE_VBI(Message, MsgMax);' ?
>
> Pat.
>
>
> On May 12, 6:49 am, Bensly <[email protected]> wrote:
> > T24 Error faced:
> >
> > JDIAG OUTPUT:
> >         jdiag - jBASE diagnostic '$Revision: 1.15 $'
> >
> > System Information
> > ==================
> >
> > System                      : AIX che-aix3 1.6 00CEB51C4C00
> > OS Release                  : 6.1.0.0
> > UNIX User                   : jdavidar (uid 205, euid 205)
> > Tty name                    : /dev/pts/15
> > Time                        : Wed May 12 11:04:35 2010
> >
> > Environment
> > ===========
> >
> > JBCPORTNO                   : Not Set
> > JBCRELEASEDIR               : '/opt/jbc503'
> > JBCGLOBALDIR                : '/opt/jbc503'
> > JEDIFILENAME_SYSTEM         : '/opt/jbc503/src/SYSTEM'
> > SYSTEM File is (DICT)       : '/opt/jbc503/src/SYSTEM]D'
> > RELEASE Information         : Major 5.0 , Minor 3 , Patch 0081 (Change
> > 49612)
> > Spooler dir (JBCSPOOLERDIR) : '/opt/jbc503/jspooler'
> > JBCEMULATE                  : 'prime'
> > Object path (JBCOBJECTLIST) : '/usr/mqm/lib64:/env/sem/bnk/bnk.run/
> > globuspatchlib:/env/sem/bnk/bnk.run/lib:/env/sem/bnk/bnk.run/
> > globuslib:/env/sem/bnk/bnk.run/lib:/env/sem/bnk/bnk.run/vinlib:/env/
> > sem/bnk/bnk.run/semlib'
> > jBASE Compiler Run-time     : '/opt/jbc503/config/system.properties'
> > Program dir (JBCDEV_BIN)    : '/env/sem/bnk/bnk.run/sembin'
> > Subroutine dir (JBCDEV_LIB) : '/env/sem/bnk/bnk.run/semlib'
> > Max open files              : 65534
> >
> > I have the following code part in a C code and have created shared
> > libraries for this code and calling this C from a basic routine. The
> > code is to get message from a MQ Server.
> >
> >                         STRING_RESIZE_VBI(Message, MsgMax);   //
> > Allocate memory to the maximum size defined. have MsgMax as 1000.
> >
> > The above line will be called multiple times as the "MsgMax" varies
> > each time. The first time the code part gets executed it was
> > successful but the next time it is called the following error is
> > thrown.
> >
> >                          ** Error [ FATAL ] **
> >                          Fatal error at trap location 2
> >
> > Also the value in the variable "Message" is lost. Does anyone know how
> > to overcome the above error.
> >
> > Any help will be appreciated and thanks in advance.
>
> --
>
> Please read the posting guidelines at:
> http://groups.google.com/group/jBASE/web/Posting%20Guidelines
>
> IMPORTANT: Type T24: at the start of the subject line for questions
> specific to Globus/T24
>
> To post, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit this group at
> http://groups.google.com/group/jBASE?hl=en
>
>
>
> --
> Please read the posting guidelines at:
> http://groups.google.com/group/jBASE/web/Posting%20Guidelines
>
> IMPORTANT: Type T24: at the start of the subject line for questions
> specific to Globus/T24
>
> To post, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit this group at
> http://groups.google.com/group/jBASE?hl=en
>
>  --
> Please read the posting guidelines at:
> http://groups.google.com/group/jBASE/web/Posting%20Guidelines
>
> IMPORTANT: Type T24: at the start of the subject line for questions
> specific to Globus/T24
>
> To post, send email to [email protected]
> To unsubscribe, send email to [email protected]
> For more options, visit this group at
> http://groups.google.com/group/jBASE?hl=en
>

-- 
Please read the posting guidelines at: 
http://groups.google.com/group/jBASE/web/Posting%20Guidelines

IMPORTANT: Type T24: at the start of the subject line for questions specific to 
Globus/T24

To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

Reply via email to