IBM Support

JSON Parsing is causing errors or corruption of large numeric values when using z/OS Connect EE

Question & Answer


Question

I have a new application that returns a JSON string (no mapping) the IBM JSON parser validates it before it is returned to the 'user'. If the JSON string contains a numeric value that is beyond the capabilities of the IBM JSON parser (for example, a DECIMAL(25,0) database field with a value of 1234567890123456789012345) the JSON parser raises an error. If the numeric value has decimal places (for example a DECIMAL(25,3) database field with a value of 1234567890123456789012.345) no error is raised but the number is returned in floating point format - it is rounded to about 17 digits and the exact number of decimal places is lost.

The application uses WebSphere Optimized Local Adapters (WOLA) and receives a request using BOA1RCA. Then it receives the data using BBOA1GET (as a JSON string in UTF-8). The application performs processing, and returns the results using BBOA1SRP. No mapping is used so the input data received from z/OS Connect Enterprise Edition (EE) is a JSON string (in the UTF-8 character set) and the application returns data to z/OS Connect as a JSON string (also using the UTF-8 character set). This processing is as documented in z/OS Connect Enterprise Edition V2.0 Getting Started Guide (Techdoc WP102604).

Here is the exception trace the user gets when an error is detected:

 Error 500: BAQR0404W: Service dvs1 encountered an error while processing a request under URL https://hostname:portnumber/zosConnect/services/dvs1.
 'FailureMessage':'BAQR0453E: An error was encountered after the dvs1 service completed the processing of WOLA target service: DVSS1 with register name: DVSR1.
 ','StackTrace':'com.ibm.zosconnect.spi.ServiceException: BAQR0453E: An error was encountered after the dvs1 service completed the processing of WOLA target service: DVSS1 with register name: DVSR1.
      at com.ibm.zosconnect.wola.internal.WOLAServiceImpl.setResponsePayload(Unknown Source) 
      at com.ibm.zosconnect.wola.internal.WOLAServiceImpl.processInvoke(Unknown Source) 
      at com.ibm.zosconnect.wola.internal.WOLAServiceImpl.invoke(Unknown Source) 
      at com.ibm.zosconnect.internal.ZosConnectServiceImpl.invoke(Unknown Source)
      at com.ibm.zosconnect.internal.ServiceManagerImpl.invoke(Unknown Source) 
      at com.ibm.zosconnect.internal.web.ServiceProxyServlet$20.run(Unknown Source) 
      at com.ibm.ws.webcontainer.async.ServiceWrapper.wrapAndRun(ServiceWrapper.java:202) 
      at com.ibm.ws.webcontainer.async.ContextWrapper.run(ContextWrapper.java:29) 
      at com.ibm.ws.webcontainer.async.WrapperRunnableImpl.run(WrapperRunnableImpl.java:74) 
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1153) 
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) 
      at java.lang.Thread.run(Thread.java:785)\nCaused by: java.io.IOException: Invalid numberliteral on line 1, column 372 
      at com.ibm.json.java.internal.Tokenizer.readNumber(Tokenizer.java:308) 
      at com.ibm.json.java.internal.Tokenizer.next(Tokenizer.java:114) 
      at com.ibm.json.java.internal.Parser.parseObject(Parser.java:109) 
      at com.ibm.json.java.internal.Parser.parseValue(Parser.java:231)
      at com.ibm.json.java.internal.Parser.parseArray(Parser.java:162) 
      at com.ibm.json.java.internal.Parser.parseValue(Parser.java:230) 
      at com.ibm.json.java.internal.Parser.parseObject(Parser.java:110) 
      at com.ibm.json.java.internal.Parser.parse(Parser.java:58) 
      at com.ibm.json.java.OrderedJSONObject.parse(OrderedJSONObject.java:65) 
      at com.ibm.json.java.OrderedJSONObject.parse(OrderedJSONObject.java:77) 
      at... 12 more
      Caused by: java.lang.NumberFormatException: For input string: \'1234567890123456789012345678123\' 
      at java.lang.NumberFormatException.forInputString(NumberFormatException.java:76) 
      at java.lang.Long.parseLong(Long.java:604) 
      at java.lang.Long.valueOf(Long.java:788) 
      at com.ibm.json.java.internal.Tokenizer.readNumber(Tokenizer.java:303)
      at... 21 more  

Answer

The design of z/OS Connect V2.07.0 EE is to use the IBM JSON parser internally and it is this that prevents the handling of large numbers. IBM is working to document this restriction in the Knowledge Center and an update should be available shortly.

An Request-for-Enhancement (RFE) request for large value support or to allow a pure passthrough of JSON since the application is returning JSON has been submitted.

You can review and vote for these RFEs at the links below if you would like this enhancement.

http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=104512 http://www.ibm.com/developerworks/rfe/execute?use_case=viewRfe&CR_ID=104513

Bill Bulfin
IBM CICS and z/OS Connect Level2 Support

[{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSGMGV","label":"CICS Transaction Server"},"Platform":[{"code":"PF035","label":"z\/OS"}],"Component":"","Version":"","Line of Business":{"code":"LOB35","label":"Mainframe SW"}},{"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SSNPJM","label":"IBM z\/OS Connect"},"Platform":[{"code":"PF035","label":"z\/OS"}],"Line of Business":{"code":"LOB35","label":"Mainframe SW"}}]

Product Synonym

CICS/TS CICSTS CICS TS CICS Transaction Server;zCEE

Document Information

Modified date:
14 February 2023

UID

dwa1367244