Automatic detection of a COBOL dialect ?

From: diesmo (partoche_at_caramail.com)
Date: 09/08/04


Date: 8 Sep 2004 08:37:32 -0700

Hello!

I am trying to enhance a javaCC parser for COBOL, which only accept
free format with "*>" comments.

I must say i have little knowledge about COBOL.
For now, I automatically detect fixed or free format, like this :
   - if the first line (without spaces) starts with a number, then it
is fixed,
   - else it is free format.

This seems to work (if the cols 1-6 in fixed format, when trimed,
always contains a number :) ).

For "variable" format, it is more tricky... Cols 1-6 may contain
anything, it seems.

Does anyone know a trick to distinguish a fixed format cobol program
from a variable format one ?
For example, if the column 1-6 only contains spaces, then it is
variable format ?
Or a way to determin the dialect (assuming each dialect uses only one
format)?
Or is it impossible, and the user must specify the format manually ?

Thanks in advance.

Regards,
diesmo.



Relevant Pages

  • Re: Automatic detection of a COBOL dialect ?
    ... >I must say i have little knowledge about COBOL. ... >For now, I automatically detect fixed or free format, like this: ... > - else it is free format. ... it is fixed format and does not have any number on the 1-6 cols. ...
    (comp.lang.cobol)
  • Re: string to correct integer
    ... I tried, Fujitsu choked on recursion, so I deleted it. ... Floating point would be the most generic output format. ... Cobol, even though it's a 'Cobol thing'. ... I do expect the string tohave ...
    (comp.lang.cobol)
  • Re: Cobol language dictionary page -- assignment complete?
    ... > Some further thoughts on free-form reference format in COBOL. ...
    (comp.lang.cobol)
  • Re: Hexadecimal Input Files
    ... COBOL does not like this format. ... If you want a tutorial on COBOL data types you can go to ... character by character using base 16 arithmetic. ...
    (comp.lang.cobol)
  • Re: J4 - presentation/discussion on "Future of the COBOL Standard"
    ... If the program you are compiling says packed-decimal the standard says it ... must be stored in packed decimal format. ... Just because CoBOL knows how to handle packed decimal, ... That said - I know of people who argued shops should switch from CoBOL ...
    (comp.lang.cobol)