Preprocessing Extensibility Examples
Examples are provided to show how metadata JSON files and configuration files must be created to integrate their business-specific cases in the analysis.
The following use case is for the situation when a
user uses the %Call using CICS XCTL
and #Copybook
macros
in a before file.
Before file example: PREPROC.bef
IDENTIFICATION DIVISION.
PROGRAM-ID. PREPROC.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FIRST-NAME PIC X(09).
01 COMMAREA-FOR-PROG2 PIC X(09).
PROCEDURE DIVISION.
MOVE 'TEST-NAME' TO FIRST-NAME.
CALL 'PROG1'
USING FIRST-NAME.
%Call using CICS XCTL
#Copybook
After file example: PREPROC.cbl
IDENTIFICATION DIVISION.
PROGRAM-ID. PREPROC.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 FIRST-NAME PIC X(09).
01 COMMAREA-FOR-PROG2 PIC X(09).
PROCEDURE DIVISION.
MOVE 'TEST-NAME' TO FIRST-NAME.
CALL 'PROG1'
USING FIRST-NAME.
EXEC CICS XCTL PROGRAM('PROG2')
COMMAREA(COMMAREA-FOR-PROG2)
LENGTH(38) END-EXEC.
CALL 'PROG3'
USING FIRST-NAME.
The following lines in
the after file are from Copybook
: CALL 'PROG3'
USING FIRST-NAME.
JSON file used for mapping: PREPROC.meta
{
"info":
{
"version":"1.0.0"
},
"metadata":
[
{
"pathType": "PC",
"beforePath":"C\\BeforeFolder\\PREPROC.bef",
"afterPath":" C\\AfterFolder \\PREPROC.cbl",
"diffResolution":
[
{
"afterPos":
{
"startLine": 1,
"endLine": 10
},
"beforePos": {
"startLine": 1,
"endLine": 10
}
},
{
"afterPos": {
"startLine": 11,
"endLine": 13
},
"beforePos":
{
"startLine": 11,
"endLine": 11
}
},
{
"afterPos":
{
"startLine": 14,
"endLine": 15
},
"beforePos": {
"startLine": 1,
"endLine": 2
},
"type": "INCLUDE",
"path": "C\\CopybooksFolder\\Copybook",
"includeStmtPos": {
"includeStmtPath": " C\\BeforeFolder\\PREPROC.bef",
"includeStmtLine": 12
}
}
]
}
]
}
Configuration file example
The configuration file contains the information of the mappings between before files, metadata files, after files, and the extensions for each type of the files:"C\BeforeFolder1\" | "C\MetaFolder1\" | " C\AfterFolder1\" | ".bef" | ".meta" | ".cbl"
"C\BeforeFolder2\" | "C\MetaFolder2\" | "C\AfterFolder2\" | ".cbl" | ".meta" | ".after"
"C\BeforeFolder3\" | "C\MetaFolder3\" | "C\AfterFolder3\" | ".cbl" | ".meta" | ".after"
Extensibility preprocessing JSON schema
{
"$schema": "http://json-schema.org/draft-06/schema#",
"title": "AD Extensibility preprocessing definition file",
"type": "object",
"properties": {
"info": {
"type": "object",
"properties": {
"version": {
"type": "string",
"description": "Version of the preprocessing metadata format",
"pattern": "^[0-9]+\\.[0-9]+\\.[0-9]+\\."
}
},
"required": [ "version" ],
"additionalProperties": false
},
"metadata": {
"type": "array",
"items": {
"type": "object",
"properties": {
"pathType": {
"type": "string",
"description": "Format of the before and after file paths: local or mainframe",
"enum": [
"PC",
"MF"
]
},
"beforePath": {
"type": "string",
"description": "Path of the original source",
"minLength": 1
},
"afterPath": {
"type": "string",
"description": "Path of the preprocessed source",
"minLength": 1
},
"diffResolution": {
"type": "array",
"description": "Ordered list of correspondences between lines in the after file and lines in the before file",
"items":
{
"oneOf": [
{
"$ref": "#/definitions/diffResolutionType1"
},
{
"$ref": "#/definitions/diffResolutionType2"
}
]
}
}
},
"required": [ "pathType", "beforePath", "afterPath", "diffResolution" ],
"additionalProperties": false
}
}
},
"required": [
"info",
"metadata"
],
"definitions":
{
"position": {
"type": "object",
"description": "Interval of lines in the source file",
"properties": {
"startLine": {
"type": "integer",
"description": "Starting line of the interval",
"minimum": 1
},
"endLine": {
"type": "integer",
"description": "Ending line of the interval",
"minimum": 1
}
},
"required": [ "startLine", "endLine" ],
"additionalProperties": false
},
"diffResolutionType1":
{
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "The type of line mapping, if a special mapping is required",
"enum": [
"INCLUDE"
]
},
"includeStmtPos" : {
"description": "Position of the include statement",
"type": "object",
"properties":
{
"includeStmtPath": {
"type": "string",
"description": "Path of the statement occurence",
"minimum": 1
},
"includeStmtLine": {
"type": "integer",
"description": "Line of the statement occurence",
"minimum": 1
}
},
"required": [ "includeStmtPath", "includeStmtLine" ],
"additionalProperties": false
},
"path": {
"type": "string",
"description": "Path to the source of the lines, if a special type of mapping was specified",
"minLength": 1
},
"beforePos": {
"description": "Position in the before file source",
"$ref": "#/definitions/position"
},
"afterPos": {
"description": "Position in the after file source",
"$ref": "#/definitions/position"
}
},
"required": [ "type", "path", "beforePos", "afterPos" , "includeStmtPos"],
"additionalProperties": false
},
"diffResolutionType2": {
"type": "object",
"properties": {
"beforePos": {
"description": "Position in the before file source",
"$ref": "#/definitions/position"
},
"afterPos": {
"description": "Position in the after file source",
"$ref": "#/definitions/position"
}
},
"required": [ "beforePos", "afterPos" ],
"additionalProperties": false
}
}
}