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 to handle copybook with multiple root records. #6895

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

Comments

@MohamedSabthar
Copy link
Member

Description:
The current implementation of the copybook module only converts a copybook file bound to a particular record. When multiple root copybook records are found in the given copybook schema, a targetRecordName is required for each operation, and an error is thrown if the targetRecordName is not provided. There is a requirement to perform all operations without a targetRecordName. In this case, the input and output data for all operations will consider the entire copybook schema, including all root records.

For example for the following schema

01 DFHCOMMAREA.
   05 BROKER-MESSAGE-AREA.
      15 MI-HDR-VERSION                          PIC X(04).
      15 MI-HDR-MSGID                            PIC X(35).
      15 MI-HDR-LOGGINGID                        PIC X(35).
01 DFHCOMMAREA-2.
   05 BROKER-MESSAGE-AREA-2.
      15 MI-HDR-VERSION-2                          PIC X(04).
      15 MI-HDR-MSGID-2                            PIC X(35).
      15 MI-HDR-LOGGINGID-2                        PIC X(35).

and for the following inputData
v1.0100 7890V100 v2.1200 7890V100
the fromCopybook(inputData) call should generate the following json output

{
  "DFHCOMMAREA": {
    "BROKER-MESSAGE-AREA": {
      "MI-HDR-VERSION": "v1.0",
      "MI-HDR-MSGID": "100",
      "MI-HDR-LOGGINGID": "7890V100"
    }
  },
  "DFHCOMMAREA-2": {
    "BROKER-MESSAGE-AREA-2": {
      "MI-HDR-VERSION-2": "v2.1",
      "MI-HDR-MSGID-2": "200",
      "MI-HDR-LOGGINGID-2": "7890V100"
    }
  }
}

Describe your problem(s)

Describe your solution(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
1 participant