IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Parsing Large JSON file using COBOL


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mbattu

New User


Joined: 19 Jan 2011
Posts: 15
Location: Toronto

PostPosted: Thu Jul 06, 2023 7:56 am
Reply with quote

Hi,

I have a requirement to process a large JSON file (> 10Mb) with complex structure. I am using JSON Parse with V6.3 compiler and Z/OS 2.6.

I am able parse the Json only when I limit the variable size to pic x(1600000). If the size is increased, job is failing with space issue.


Any inputs how to parse Large Json files

Code:
     05 json-jtxt-1208              PIC X(1600000) VALUE SPACE. 


Code:
JSON PARSE json-jtxt-1208 into applicationArea 
  WITH DETAIL                                   
  ON EXCEPTION                                 
    DISPLAY "UNSUCCESSFUL JSON PARSE"           
    DISPLAY "json-code   :"json-code           
    DISPLAY "json-status :"json-status         
  NOT ON EXCEPTION                             
    DISPLAY "SUCCESSFUL JSON PARSE"             
END-JSON.                                       
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1744
Location: Tirupur, India

PostPosted: Thu Jul 06, 2023 5:33 pm
Reply with quote

Quote:
If the size is increased, job is failing with space issue.

What is the error message that you get? Space issue can be many numbers of variations.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Thu Jul 06, 2023 9:45 pm
Reply with quote

The limitation is something with your site. I've parsed JSON variables with 10 million bytes with no problems. Depending upon your site, you may need to adjust the region or MEMLIMIT parameter for the job and/or the step, but there's no inherent limit to COBOL variables other than what the compiler imposes. If you're using compiler option LP32 you are limited to 999,999,999 bytes per variable. If you're using compiler option LP64 you are limited to 2,147,483,646 bytes per variable. These limits will depend upon your region and MEMLIMIT specifications.
Back to top
View user's profile Send private message
mbattu

New User


Joined: 19 Jan 2011
Posts: 15
Location: Toronto

PostPosted: Thu Jul 06, 2023 11:47 pm
Reply with quote

Robert Sample wrote:
The limitation is something with your site. I've parsed JSON variables with 10 million bytes with no problems. Depending upon your site, you may need to adjust the region or MEMLIMIT parameter for the job and/or the step, but there's no inherent limit to COBOL variables other than what the compiler imposes. If you're using compiler option LP32 you are limited to 999,999,999 bytes per variable. If you're using compiler option LP64 you are limited to 2,147,483,646 bytes per variable. These limits will depend upon your region and MEMLIMIT specifications.


Thanks for your reply Robert. Yes, I checked with my systems team and it is the limit imposed at our site. Is there any other solution like parsing the JSON in segments (like in XML parse with PROCESSING PROCEDURE and moving 1 to XMLCODE).

I think we can't use LP64 on JSON Parse yet. Anyways it doesn't matter to my problem as I can't make use of full 999,999,999 bytes with LP32
Back to top
View user's profile Send private message
haroldo

New User


Joined: 13 Nov 2018
Posts: 2
Location: Chile

PostPosted: Fri Aug 18, 2023 7:34 pm
Reply with quote

you can override the installation default in your program www.ibm.com/docs/en/zos/2.1.0?topic=options-lp64-ilp32
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts COBOL sorting, with input GDG base COBOL Programming 7
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 0
No new posts Replacing FILLER with FILLER<SeqNu... DFSORT/ICETOOL 2
No new posts how to eliminate null indicator value... DB2 7
No new posts Compile Sp Cobol base COBOL Programming 1
Search our Forums:

Back to Top