Skip to main content
Solved

How to get the full message from json-code

  • August 4, 2026
  • 2 replies
  • 29 views

DaveO

Hi Everyone,

I’m on AcuCOBOL 10.4.1 and I’m trying to use JSON PARSE.  I’m getting an error and while I can get the error code (JSON-CODE) I can’t figure out how to get the additional information in the description that I see in the manual.  For instance, if I get code 100, I’m looking for the full message “JSON PARSE on line <line-num>, JSON text invalid at offset <offset>.” with <line-num> and <offset> filled in so I can actually find the offending part of my input.

I couldn't find anything in the documentation or examples that did anything except display JSON-CODE.

Best answer by Martin Turner

You’ll want to use the WITH DETAIL phrase:


General Rules
...
5. When the WITH DETAIL phrase is specified, JSON PARSE generates run-time error messages when it encounters both non-exception and exception conditions.

JSON PARSE Statement

2 replies

Martin Turner
Forum|alt.badge.img+2
  • Moderator
  • Answer
  • August 5, 2026

You’ll want to use the WITH DETAIL phrase:


General Rules
...
5. When the WITH DETAIL phrase is specified, JSON PARSE generates run-time error messages when it encounters both non-exception and exception conditions.

JSON PARSE Statement


DaveO
  • Author
  • New Participant
  • August 5, 2026

Hi Martin,

Thank you!  I thought that might have been it, but I wasn’t seeing anything.  What I didn’t remember is that I was sending stderr to /dev/null so all those messages were just being thrown away.  I’m now getting all of the messages I was looking for.

Dave