MCH3601 - Pointer not set for location referenced

Discussions relating to writing software in ILE RPG (RPG IV). This includes both fixed and free format RPG.
Post Reply
psteinmetz
Posts: 1
Joined: Tue Sep 28, 2021 2:01 am

MCH3601 - Pointer not set for location referenced

Post by psteinmetz »

Receiving below MCH3601 errors - Pointer not set for location referenced.
Any thoughts from the group on what might be causing this.
V7R3-latest CUME and groups.
YAJL for IBM i - Version 10/14/20

Message ID . . . . . . : MCH3601 Severity . . . . . . . : 40
Date sent . . . . . . : 09/20/21 Time sent . . . . . . : 08:33:29
Message type . . . . . : Escape
From . . . . . . . . . : CPACOPER CCSID . . . . . . . . : 65535

From program . . . . . . . . . : YAJL
From library . . . . . . . . : SYS
From module . . . . . . . . : YAJL_TREE
From procedure . . . . . . . : yajl_obj_get
From statement . . . . . . . : 1

To program . . . . . . . . . . : YAJL
To library . . . . . . . . . : SYS
To module . . . . . . . . . : YAJL_TREE
To procedure . . . . . . . . : yajl_obj_get
To statement . . . . . . . . : 1
Time sent . . . . . . . . . . : 08:33:29.037372
Time zone abbreviated name . : EDT
jonboy49
Posts: 200
Joined: Wed Jul 28, 2021 8:18 pm

Re: MCH3601 - Pointer not set for location referenced

Post by jonboy49 »

Usual reason is just what it says ... you tried to use a pointer that has not been set.

Possible causes:
- Parameter that wasn't passed and not tested for
- Call to a YAJL function that returns a pointer that did not result in a "hit" and so the pointer was not set and then attempted to be used.

WIthout a code snippet or any indication of when/how this happens we're just guessing.

Was the program working and now stopped? New program?
Scott Klement
Site Admin
Posts: 635
Joined: Sun Jul 04, 2021 5:12 am

Re: MCH3601 - Pointer not set for location referenced

Post by Scott Klement »

It'd be very helpful if you showed us how to reproduce the problem.

Off the top of my head, I know I could DELIBERATELY create the same problem by doing the following:

Code: Select all

    yajl_obj_find(*null: 'something');
But... Since we don't know what you are doing, it's hard to tell if that's what's happening in your case.

Frequently you'll see people get this error when they do something like this:

Code: Select all

{
  "name": "Scott",
  "mailing address": {
     "street": "123 Sesame St"
  },
  "billing address": {
     "street": "123 Sesame St"
  }
}

shipAddr = yajl_obj_find(docNode: 'shipping address');
street = yajl_obj_find(shipAddr: 'street');
Since there is no 'shipping address' in the document, the first yajl_obj_find() will return *null. Then, it passes *null to the second yajl_obj_find(), which will result in the MCH3601.

If an element is optional, it's always better to code it like this:

Code: Select all

shipAddr = yajl_obj_find(docNode: 'shipping address');
if shipAddr = *null;
  Street = '';  // shipping address not found.
else;   
  street = yajl_obj_find(shipAddr: 'street');
endif;
Post Reply