copybook
Module copybook
ballerinax/copybook Ballerina library
Overview
This module provides APIs to convert Cobol Copybook data to JSON or Ballerina records and vice versa.
Classes
copybook: Convertor
This class represents a copybook convertor that facilitates the conversion of ASCII data to and from JSON data.
Constructor
Initializes the convertor with a schema.
init (string schemaFilePath)
- schemaFilePath string - The path of the copybook file
toJson
Converts the given ASCII string to a JSON value.
Parameters
- copybookData string - The ASCII string that needs to be converted to JSON
- targetRecordName string? (default ()) - The name of the copybook record definition in the copybook. This parameter must be a string if the provided schema file contains more than one copybook record type definition
Return Type
toCopybook
Converts the provided record or map
Parameters
- input record {} - The JSON value that needs to be converted as copybook data
- targetRecordName string? (default ()) - The name of the copybook record definition in the copybook. This parameter must be a string if the provided schema file contains more than one copybook record type definition
Return Type
fromCopybook
function fromCopybook(string copybookData, string? targetRecordName, typedesc<record {}> t) returns t|Error
Converts the given ASCII string to a Ballerina record.
Parameters
- copybookData string - The ASCII string that needs to be converted to a record value
- targetRecordName string? (default ()) - The name of the copybook record definition in the copybook. This parameter must be a string if the provided schema file contains more than one copybook record type definition
- t typedesc<record {}> (default <>) - The type of the target record type
Return Type
- t|Error - A record value on success, a
copybook:Error
in case of coercion errors
Errors
copybook: Error
Represents copybook module related errors.
Import
import ballerinax/copybook;
Metadata
Released date: about 1 year ago
Version: 0.1.3
License: Apache-2.0
Compatibility
Platform: java17
Ballerina version: 2201.8.0-20230830-220400-8a7556d8
GraalVM compatible: Yes
Pull count
Total: 72
Current verison: 4
Weekly downloads
Keywords
copybook
serdes
cobol
mainframe
Contributors