A few of my favorite COBOL features are JSON GENERATE and JSON PARSE. If you want more information https://www.youtube.com/watch?v=N_Zsd1W8hWc
JSON support is a nice feature if your COBOL systems need to communicate with RESTFUL services in the cloud (or in your own local environment) or if the COBOL program needs to process (or produce) JSON formatted data.
Historically this is not a feature that was available in most COBOL systems. For such systems it is possible to create a JSON parser using COBOL code so that COBOL programs can utilize JSON structures if necessary. This can help to enhance the capability of some of those old workhorse COBOL programs that some organizations rely upon.
I found the FUNCTION HEX-OF(alphanumeric-item) to be valuable last week. Saved a lot of lines of coding, as well as being easier to read.
There is also a BIT-OF function too, if you want to get the bit-string of the alpha.
This is new with Enterprise COBOL V6.3
Been coding COBOL for 40 plus years I’ve never heard of JSON. What is that?
Hi Richard –
though I’d skip the history section, it’s more confusing than enlightening.
I’m a huge fan of our environment (Veryant/isCOBOL) and its ability to create API-accessible programs. We can use certain compiler settings to generate RESTful COBOL endpoints and define the structure of the JSON object for the HTTP requests using syntax on a linkage section of the program. We’ve built an entire RESTful COBOL application with a ReactJS frontend because of this functionality.
Thanks for the new view. How do you invoke APIs in COBOL? Are you using cloud?
Curious to know.
Our runtime environment and version of COBOL, isCOBOL from Veryant, has built-in functionality that allows you to create a “bridge” program based on the linkage section. That bridge uses OOP to connect to HTTP requests sent via (in our case) Tomcat. The bridge then unpacks the expected JSON or XML object and properly loads the data into the corresponding linkage section group item. That data is then passed in to the main program. It’s super easy and has been game changing for us.
Thanks. That helps.
Could you please share sample example how to use JSON to communicate to COBOL ?
Please have a look at IBM’s sample: