Menu

#11 COBOL Parser error on copybooks with data in positions 72:80

Release 4.3.3
closed
None
2014-05-08
2014-05-06
No

Stingray is barfing when trying to parse this copybook....and right at the beginning too...

I'm not seeing anything that strange here..

DEBUG:stingray.cobol.loader: 01 REPORT-TAPE-DETAIL-RECORD.
DEBUG:stingray.cobol.loader: 01 REPORT-TAPE-DETAIL-RECORD.
DEBUG:Lexer:01
DEBUG:Lexer:REPORT-TAPE-DETAIL-RECORD
DEBUG:Lexer:.
DEBUG:stingray.cobol.loader: 02 RDT-REC-CODE-BYTES. 00000130
DEBUG:stingray.cobol.loader: 02 RDT-REC-CODE-BYTES. 00000130
DEBUG:Lexer:02
DEBUG:Lexer:RDT-REC-CODE-BYTES
DEBUG:Lexer:.
DEBUG:Lexer:00000130
DEBUG:stingray.cobol.loader: 03 RDT-REC-CODE-KEY PIC X. 00000140
DEBUG:stingray.cobol.loader: 03 RDT-REC-CODE-KEY PIC X. 00000140
DEBUG:Lexer:03
DEBUG:Lexer:RDT-REC-CODE-KEY
Traceback (most recent call last):
File "/home/rharris/stingraytest/stingray/cobol/loader.py", line 867, in dde_iter
usage= self.usage2( self.token )
File "/home/rharris/stingraytest/stingray/cobol/loader.py", line 783, in usage2
else: raise SyntaxError( "Unknown usage clause %r" % use )
stingray.cobol.loader.SyntaxError: Unknown usage clause 'RDT-REC-CODE-KEY'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./orig.py", line 35, in <module>
schema= stingray.cobol.loader.COBOLSchemaLoader( cobol, replacing=[("'XXXX'","X")] ).load()
File "/home/rharris/stingraytest/stingray/cobol/loader.py", line 1051, in load
schema= make_schema( dde_iter )
File "/home/rharris/stingraytest/stingray/cobol/loader.py", line 1028, in make_schema
for record in dde_iter:
File "/home/rharris/stingraytest/stingray/cobol/loader.py", line 913, in makeRecord
for dde in ddeIter:
File "/home/rharris/stingraytest/stingray/cobol/loader.py", line 870, in dde_iter
raise SyntaxError( "%s unrecognized" % self.token )
stingray.cobol.loader.SyntaxError: RDT-REC-CODE-KEY unrecognized</module>

Discussion

  • Steven F. Lott

    Steven F. Lott - 2014-05-06

    The "DEBUG:Lexer:00000130"

    Indicates that the columns 72-80 junk is being parsed.

    This requires a subclass of the default Lexer to remove the trailing junk.

    Override the clean() method to strip additional junk from the records.

        def clean( self, line ):
            """Default cleaner removes positions 0:5."""
            return line[6:].rstrip()
    

    Positions 72-80 must be removed for lines which are long enough.

     

    Last edit: Steven F. Lott 2014-05-06
  • Steven F. Lott

    Steven F. Lott - 2014-05-06
    • status: open --> pending
    • assigned_to: Steven F. Lott
     
  • Steven F. Lott

    Steven F. Lott - 2014-05-06

    Add cobol.loader.Lexer_Long_Lines to handle this.

     
  • Steven F. Lott

    Steven F. Lott - 2014-05-08
    • summary: COBOL Parser error --> COBOL Parser error on copybooks with data in positions 72:80
    • status: pending --> closed
     

Log in to post a comment.

MongoDB Logo MongoDB