isCOBOL EIS
isCOBOL IES provides a utility called Service Bridge to automatically generate SOAP and REST services from a legacy COBOL program with Linkage Section.
Starting from isCOBOL2019R1, custom COBOL code can now be inserted into the source code that is automatically generated by the Web Service Bridge feature.
The Native Boolean data type is now supported in JSON and XML data definitions.
Custom code
Custom code can be inserted into the source code that is automatically generated by the Web Service Bridge feature. The generated code is embedded in the *>start and *>end directives. Code that is written outside those tags will be preserved during the automatic generation of the tagged areas, allowing custom behavior to be included as part of the program. The code below shows how to add a CALL to MYPROG after input parameters have been parsed by the runtime and before the ws-info legacy program is invoked.
*>start {iscobol}http-to-linkage move PAR1-in to intPAR1;; *>end {iscobol}http-to-linkage *> This is my custom code written outside the Tagged Areas CALL "MYPROG" USING intPAR1 *>start {iscobol}call call "ws-info" using intPAR1 *>end {iscobol}call |
A typical use case of custom code is to check for security and authentication tokens passed in the HTTP header of the request, which would normally be ignored by the Service Bridge feature. Logging and transformation of input and output parameters are other use cases for custom code.
Boolean data type
Boolean type variables can now be specified in the request and response elements that will be transformed in JSON or XML data streams.
The sample code below shows how to use the new IS BOOLEAN syntax to specify that a variable will receive true/false values. If the variable is defined as pic 9, the value 1 will be rendered as “true” and 0 as “false” when writing, and will be parsed as value 1 when true is read and 0 when false is read. When pic x is specified, the resulting data will be the string “true” or “false”.
01 js-stream-data identified by "names". 02 identified by "list" occurs dynamic capacity js-cap. 04 js-first-name identified by "FirstName". 06 js-first-name-data pic x any length. 04 js-last-name identified by "LastName". 06 js-last-name-data pic x any length. 04 js-city identified by "City". 06 js-city-data pic x any length. 04 js-foreign identified by "Foreign" IS BOOLEAN. 06 js-foreign-data pic x any length. |
The JSON generated:
{ "names":{ "list":[ { "FirstName":"John", "LastName":"Red", "City":"Miami", "Foreign":false }, { "FirstName":"Mario", "LastName":"Rossi", "City":"Milan", "Foreign":true } ] } } |