-
Notifications
You must be signed in to change notification settings - Fork 79
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
Can't read multiple main headers defined in single copybook #670
Comments
@yruslan can you please provide your thoughts on this. Thanks! |
Yes, it is possible to use Cobrix specifying more than one copybook using:
This will create a layout where root GROUPs redefine each other for each copybook. For example, if copybooks are: val copyBookContents1: String =
""" 01 RECORD-COPYBOOK-1.
| 05 GROUP-1.
| 06 FIELD-1 PIC X(10).
| 06 FILLER PIC X(5).
| 06 GROUP-2.
| 10 NESTED-FIELD-1 PIC 9(10).
| 10 FILLER PIC 9(5).
|""".stripMargin
val copyBookContents2: String =
""" 01 RECORD-COPYBOOK-2A.
| 05 GROUP-1.
| 06 FIELD-1 PIC X(20).
| 06 FILLER PIC X(10).
| 06 GROUP-2.
| 10 NESTED-FIELD-1 PIC 9(20).
| 10 FILLER PIC 9(10).
| 01 RECORD-COPYBOOK-2B REDEFINES RECORD-COPYBOOK-2A.
| 05 GROUP-1.
| 06 FIELD-1 PIC X(20).
| 06 FILLER PIC X(10).
| 06 GROUP-2.
| 10 NESTED-FIELD-1 PIC 9(20).
| 10 FILLER PIC 9(10).
|""".stripMargin
val copyBookContents3: String =
""" 01 RECORD-COPYBOOK-3.
| 05 GROUP-1.
| 06 FIELD-1 PIC X(30).
| 06 FILLER PIC X(15).
| 06 GROUP-2.
| 10 NESTED-FIELD-1 PIC 9(30).
| 10 FILLER PIC 9(15).
|""".stripMargin The merged copybook layout will be:
I usually prefer to combine copybooks manually so I have more control on which fields are part of every segment, and which are different for each segment. |
@yruslan Thanks for your reply. In my case there are multiple record types defined in single copybook. So, do you think this ".option("copybooks", "/path/to/copybook1,/path/to/copybook2,/path/to/copybook3")" works? |
The "copybooks" options is specifically designed for the situation of multiple record types. And it works for our use cases. |
Background [Optional]
I'm not able to read multiple main headers defined in single copybook .Cause Cobrix can handle only one Main header copybook no multiple.
In my project i have a requirement to read multiple copybooks as One main Copybook using Cobrix.
Example:
TRANSACTION.CPY
01 CUSTOMERS
05 PURCHASES
FIRST_NAME PIC X (04)
LASTNAME_NAME PIC X (04)
01 ORGANIZATION
05 DEPARTMENTS
ORG_NAME PIC X (04)
VENDOR_NAME PIC X (09)
01 MEDICARE
05 BILLS
TREATMENT_TYPE PIC X (04)
LOCATION_NAME PIC X (09)
01 MEMBERSHIP
05 PARTNERS
PARTNER_TYPE PIC X (04)
PARTNER_NAME PIC X (09)
Question
Does cobrix have a limitation in reading multiple copybook that defined in single copybook? Can we achieve it using cobrix in this case?
The text was updated successfully, but these errors were encountered: