× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Convert MI to HLL
  • From: "Glenn Howald" <ghowald@xxxxxxxxxx>
  • Date: Thu, 12 Oct 2000 11:27:52 -0600
  • Importance: Normal

Forgive a newbie type question or two here, but I am stuck and even if I
cannot do what I want, I am very curious to find out how this should be done
and what I did wrong.

I have the following C/400 program which should retrieve a pointer to some
information about a *PNLGRP type object (type 0x19 subtype 0x15).

#include <QSYSINC/MIH/RSLVSP>
#include <QSYSINC/MIH/SETSPPFP>
#include <stdio.h>

void * getspcptr(int objType, char * objName, char * libName, int reqAuth)
{                                                                           
   _SYSPTR              objPtr;                                             
   _SPCPTR              spcPtr;                                             
   char *               cp;                                                 
                                                                            
   objPtr = rslvsp(objType, objName, libName, reqAuth);                     
                                                                            
   spcPtr = setsppfp(objPtr);                                               
   cp = (char *) spcPtr;                                                    
                                                                            
   return((void*)spcPtr);                                               
}                                                                       
                                                                        
int main(void)                                                          
{                                                                       
   void * ptr;                                                          
                                                                        
   ptr = getspcptr(0x1915, "LM861P", "GRHLIB", 0);                      
                                                                        
   return 1;                                                            
}                                                                       

What happens when I run it in debug (V4R4M0, security level 40) is that objPtr 
appears to be assigned correctly.
 EVAL objPtr                                                           
 objPtr =                                                              
           SYP:LM861P                        :1915:GRHLIB    :000000000
           0000000                                                     
                                                                       
Then the next line (assigning spcPtr using the setsppfp function) returns error 
MCH6801 (Object domain or hardware storage protection violation.). Apparently, 
there is some kind of system-level protection preventing me from even viewing 
the underlying details of an object (in this case created by me, I also have 
*ALLOBJ authority). I am guessing that this program needs to be a 
"system-state" program to do this or I have made some other sort of mistake in 
its implementation.

I have also tried to get this to work calling the C wrappers for these MI 
instructions from RPG, but with at least as bad luck.

The questions I have are as follows:

1. Do you see anything wrong in the source code I submitted?

2. Should I be able to do this?

3. If the answer in 2 is yes, how?

4. If I need system-state, can I write a callable module or program which is in 
system-state? Again, how? (respond off-list).

Thanks in advance,

Glenn Howald
Programmer/Analyst
Gateway Software Corporation



+---
| 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 thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 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.