+ Reply to Thread
Results 1 to 3 of 3

Thread: MCH3601 and Subprocedures.

  1. #1
    Guest.Visitor Guest

    Default MCH3601 and Subprocedures.

    MCH3601 is ?Pointer not set for location referenced.? I have a Sub-Procedure that I want to feed an address. Then have the Sub-Procedure change the values at that memory location, pointed to by the address. Then end. This will change the values for the calling program since the memory is allocated in the calling program. The reason I don?t use parameters is that this is a utility type Service Program, and all I want to have to modify is the Data-Structure InnerListStrut in the calling program, and not create a Service Program for every possible Data-Structure, there could be 100+. Here is a snippet of the code. Calling program??
     D ptr S * D InnerListStrut DS D GroupName 10A D GroupValue 30A D ValueInHex 1A C EVAL ptr = %ADDR(InnerListStrut) C CALLP pGetNextILVal(ptr) /
     Subprocedure code??? 
     P pGetNextILVal B EXPORT D pGetNextILVal PI * Receiving Pointer D ReceiveingP * VALUE * Char string for debuging. D ReceiverChar S 32767A BASED(ptr) D Work2Char S 2A D Start S 5S 0 C EVAL Start = pGetOffSet(1) + g_MDILBECFL + 1 C EVAL ptr = ReceiveingP C EVAL ReceiverChar = %SubSt(g_LWLString: C Start: C g_InnerListsL) P pGetNextILVal E /
     Every time a run the program I get the MCH3601 error when the Sub-Procedure returns. Why on the return? The Sub-Procedure does not have a return parameter defined. The Sub-Procedure has already changed the value in memory, I can see it in debug.

  2. #2
    Guest.Visitor Guest

    Default MCH3601 and Subprocedures.

    Hi Paul, One thing pops up immediately: The calling code passes pointer to InnerListStrut of size 41 (10+30+1). The pGetNextILVal procedure modify the pointed area, but regarded with size 32767. The following code actualy modify the all 32767 bytes: C EVAL ReceiverChar = %SubSt(g_LWLString: C Start: C g_InnerListsL) So what happens is that InnerListStrut from position 42 is actually erasing the code that follows it in the calling program. The MCH3601 is a "Pointer not set" because the calling program is kind of "destroyed". If you add a dummy field just after InnerListStrut, with size of 32726=32767-41 (or more), the code that comes after it is not effected. Another idea is to pass the size of the target string to the procedure and modify only the actual size (the same as all AS/400 API's, they always need the target string size): C EVAL %SubSt(ReceiverChar:1:size) = C %SubSt(g_LWLString:Start:g_InnerListsL) Hope this helps, Arbel

  3. #3
    Guest.Visitor Guest

    Default MCH3601 and Subprocedures.

    That was it! Boy do I feel dumb Some days you cannot see the forest through the trees. Thanks, Hope I can return the favor some day.

+ Reply to Thread

Similar Threads

  1. MCH3601 - Pointer not set for location referenced.
    By David Abramowitz in forum RPG
    Replies: 8
    Last Post: 05-09-2006, 09:28 AM
  2. Unmoniterd message MCH3601
    By Guest.Visitor in forum Programming
    Replies: 5
    Last Post: 07-05-2001, 03:52 AM
  3. MCH3601 when try to setll
    By Guest.Visitor in forum Application Software
    Replies: 2
    Last Post: 05-26-2000, 05:49 AM
  4. MCH3601 Exception
    By Guest.Visitor in forum Programming
    Replies: 1
    Last Post: 02-03-2000, 02:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts