|
Hi Shahar,
You get that error if you don't put the size of the usrspc in the first 4 bytes
of the usrspc before calling the API.
I compiled the following test pgm and it worked.
--Dave
/**************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <qusmiapi.h>
#include <QSYSINC/MIH/RSLVSP>
#include <QSYSINC/MIH/MIOBJTYP>
#include <QSYSINC/H/QUSPTRUS>
#include <QSYSINC/MIH/MATCTX>
void MATCTXC(_LIB_NAME prlib, void * Options);
/**************************************************************/
void main(int argc, char **argv)
{
char prlib[31] = "DMTEST6";
_MCTX_Options_T Options;
_MCTX_Template_T *pTemplate;
QUSPTRUS("MATCTXSPC QTEMP ", &pTemplate);
pTemplate->Template_Size = 32768;
pTemplate->Bytes_Used = 0;
memset(&Options, 0, sizeof(Options));
Options.Info = _MCTX_SYMBOLS;
MATCTXC( prlib, &Options);
return;
}
/**************************************************************/
void MATCTXC(_LIB_NAME prlib, void * Options) {
_SYSPTR lib_ptr;
_SPCPTR TargetSpace;
lib_ptr = rslvsp(_Library, prlib, "QSYS", _AUTH_OBJ_MGMT);
QUSPTRUS("MATCTXSPC QTEMP ", &TargetSpace);
QusMaterializeContext(TargetSpace,
lib_ptr,
Options);
}
shahar mor wrote:
> Hi all,
>
> I'm trying to write a utility to display changed
> objects. It is mainly in rpg and call c for the
> qusmatarializecontext api (didnt want to use system
> pointers in rpg).
>
> I didnt want to use mi since matctx is not directly
> supported.
>
> So the rpg creates a user space manges the selection
> structure and call the c module. This is the c module:
> /**************************************************************/
>
> /* This program is used to materialize context with
> supported */
> /* interface.
> */
> /*
> */
> /* Parms:
> */
> /* Library (context) name
> */
> /* Pointer to space for materialization
> */
> /* Pointer to Object selection structure
> */
> /**************************************************************/
>
>
>
> #include <qusmiapi.h>
>
> #include <QSYSINC/MIH/RSLVSP>
>
> #include <QSYSINC/MIH/MIOBJTYP>
>
> #include <QSYSINC/H/QUSPTRUS>
>
> void MATCTXC(_LIB_NAME prlib,void * Options) {
>
>
>
> _SYSPTR lib_ptr;
>
> _SPCPTR TargetSpace;
>
>
>
> lib_ptr = rslvsp(_Library, prlib, "QSYS",
> _AUTH_OBJ_MGMT);
> QUSPTRUS("MATCTXSPC QTEMP ", &TargetSpace);
>
>
>
> QusMaterializeContext(TargetSpace,
>
> lib_ptr,
>
> Options);
>
> }
>
>
> The c program does not work and i get :
> *************************************************************************
> Message ID . . . . . . : MCH0601 Severity . .
> . . . . . : 40
> Message type . . . . . : Escape
>
> Date sent . . . . . . : 14/09/00 Time sent .
> . . . . . : 11:23:41
>
>
> Message . . . . : Space offset X'00000000' is
> outside current limit for
> object MATCTXSPC.
>
> Cause . . . . . : You tried to operate outside the
> specified space or tried
> to set the space pointer outside the specified
> space. The object referred to
> is MATCTXSPC. The offset specified is X'00000000'.
> The space class is X'00'.
> The secondary associated space number is X'0000'.
> The activation group mark
> is X'00000000'. The heap space identifier is
> X'00000000'. The pointer to the
> start of the implicit process space used for the
> allocation is
> X'AF000000000000000000000000000000'. The space
> class designates the
> ***********************************************************************
>
> What is my problem here ? i'm quite sure the space
> pointer targetspace is ok.
>
> Thanks for helping a begginer
>
>
> =====
> Shahar mor
> consultant
+---
| This is the MI Programmers Mailing List!
| To submit a new message, send your mail to MI400@midrange.com.
| To subscribe to this list send email to MI400-SUB@midrange.com.
| To unsubscribe from this list send email to MI400-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: dr2@cssas400.com
+---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.