Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the VALUE clause in the copybook module #6863

Closed
MohamedSabthar opened this issue Aug 13, 2024 · 0 comments · Fixed by ballerina-platform/module-ballerinax-copybook#39

Comments

@MohamedSabthar
Copy link
Member

Description:
Consider the following copybook schema:

01 REC.
   03 FIELD-01                PIC XXX VALUE 'YES'.
   03 FIELD-02                PIC 9(02) VALUE 10.

When a VALUE clause is provided in the schema, the copybook module should use these values when generating ASCII string using toCopybook() API.

For the above schema the module should generate following string YES10 when no explicit values provided to the fields.

import ballerina/io;
import ballerinax/copybook;

public function main() returns error? {
    copybook:Converter converter = check new ("schema.cbl");
    map<json> inputData = {REC: {}}; // no values provided for FIELD-01 and FIELD-02
    string ascii = check converter.toCopybook(inputData);
    io:println(ascii); // YES10
}

Describe your task(s)

Related Issues (optional):

Suggested Labels (optional):

Suggested Assignees (optional):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant