Comments (4)
Hi, do I understand it right that you are traversing an AST to find if a given field is redefined by another field and, if yes, find that redefined field?
As far as I understand a field can redefine another field only if that field is at the same hierarchical level (same level of nesting) and is consecutive to the field being redefined.
For instance, this is ok:
10 A PIC X(5).
10 B PIC X(5) REDEFINES A.
10 C PIC X(5) REDEFINES A.
But this is incorrect since C does not redefine A:
10 A PIC X(5).
10 B PIC X(5) REDEFINES A.
10 C PIC X(5).
10 D PIC X(5) REDEFINES A.
This means that an ambiguity in redefined field names can only occur if there is more than 1 field with the same name at the same level of nesting. But such fields are prohibited by the compiler and even if this was allowed a fully qualified name won't help resolve the ambiguity.
But I'm not sure I understand correctly the issue you are trying to solve. Maybe you can share the piece of code you use for redefined fields searching I can help you with that.
from cobrix.
Hi,
I understand your point. I was working with a copybook like below
01 COMPANY-DETAILS.
05 SEGMENT-ID PIC X(5).
05 COMPANY-ID PIC X(10).
05 STATIC-DETAILS.
10 COMPANY-NAME PIC X(15).
10 ADDRESS PIC X(25).
10 TAXPAYER REDEFINES ADDRESS.
15 TAXPAYER-TYPE PIC X(1).
15 TAXPAYER-STR PIC X(8).
15 TAXPAYER-NUM REDEFINES TAXPAYER-STR PIC 9(8) COMP.
05 CONTACTS REDEFINES STATIC-DETAILS.
10 COMPANY-ID PIC X(17).
10 CONTACT-PERSON REDEFINES COMPANY-ID PIC X(28).
10 PHONE-NUMBER-X PIC X(2).
10 CONTACT-PERSON-X REDEFINES PHONE-NUMBER-X PIC X(2).
in this structure, there are two COMPANY-IDs. So when I am trying to find out Compant-id it is giving me an error like "Multiple fields with name 'COMPANY_ID' found in the copybook. Please specify the exact field using '.' notation.". But as you stated avobe, I can implement some rules to find out correct Copmany-ID. Thanks for your answer.
from cobrix.
If you are using getFieldByName()
or getFieldValueByName()
to search for COMPANY-ID
, you can use a fully qualified name, e.g. COMPANY-DETAILS.COMPANY-ID
or CONTACTS.COMPANY-ID
.
from cobrix.
Yes, that I was asking as a part of Redefine info of a Statement(Group/Statment) :-)
from cobrix.
Related Issues (20)
- File start/end offset issue for VB file HOT 5
- RDW headers should never be zero (0,0,0,0). Found zero size record at 4078719. HOT 1
- Stream processing with Flink HOT 1
- Not able to run simple cobol app with java HOT 1
- Process ASCII file with fixed length format HOT 5
- US ASCII file with newline character present within data HOT 1
- ebcdic_code_page for German character Γ€,Γ,ΓΌ HOT 9
- Can I get the raw record bytes from ebcdic file w/out parsing HOT 4
- BBBB in copybook HOT 3
- Is it possible to read a nested Binary Field? HOT 1
- Record length option is ignored when generate record id is turued on
- Add CI/CD for automatic releases
- Reading EBCDIC file with multiple structure HOT 1
- DataBricks Unity Catalog and Cobrix HOT 7
- Reading Variable Length File with OCCCURS DEPENDING HOT 12
- NoClassDefFoundError: Could not initialize class za.co.absa.cobrix.cobol.parser.decoders.FloatingPointDecoders$ HOT 3
- Not able to parse the content correctly when copybook has OCCURS X TIMES DEPENDING ON FIELD_NAME HOT 3
- Support for decimal scaling PV HOT 6
- Can't read multiple main headers defined in single copybook HOT 4
- Add support for parsing copybooks given Spark options
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cobrix.