Generating mappings from a JSON schema

To create application data from JavaScript Object Notation (JSON) or JSON from application data, you create the mappings to describe how CICS® should transform the data and JSON at run time. You can start from a JSON schema. After the language structure and the mapping are generated, you can develop CICS application using the language structure, and transform JSON to application data and vice versa.

Before you begin

Before you create the mappings, you must make sure that these preconditions are met:
  • You must have the JSON schema that describes a JSON record.
  • You must configure the user ID under which DFHJS2LS runs to use z/OS® UNIX.
  • The user ID must have read permission to access the JSON schema and write permission to put the output in the appropriate directories on z/OS UNIX.
  • You must allocate sufficient storage to the user ID for the ID to run Java™ . You can use any supported version of Java.

About this task

Use the CICS JSON assistant to create the data mappings for the application record. The CICS JSON assistant creates a CICS bundle and issues error messages about any unsupported items that it identifies in your language structure. The reference information for the CICS JSON assistant lists the restrictions that apply to each high-level language. For more information, see DFHJS2LS: JSON schema to high-level language conversion for linkable interface.

Procedure

Run the DFHJS2LS batch job. DFHJS2LS has optional parameters that you select to meet your requirements, such as selecting a particular code page. Use the following parameters as a minimum:

Results

A CICS bundle that contains one JSON transformation is generated. A language structure is generated.
The following example shows DFHJS2LS with the minimum set of parameters specified.
//JS2LS JOB 'accounting information',name,MSGCLASS=A
// SET QT=''''
//JCLLIB JCLLIB ORDER=FPHLQ.SDFHMOBI
//JAVAPROG EXEC DFHJS2LS,
//INPUT.SYSUT1 DD *
LANG=COBOL
BUNDLE=/u/exampleapp/bundle/test2
LOGFILE=/u/exampleapp/jsbind/example.log
MAPPING-LEVEL=3.0
PDSLIB=/u/exampleapp
PDSMEM=CPYBK2
JSONTRANSFRM=example.jsbind
JSON-SCHEMA=/u/exampleapp/example.json
/*

What to do next

Write an application program to transform the application data to JSON and vice versa. You can use the same mappings for both transformations.


generate_mappings_from_jsonschema.html | Timestamp icon Last updated: Monday, 5 June 2017