Re: Automatic detection of a COBOL dialect ?
From: Frederico Fonseca (real-email-in-msg-spam_at_email.com)
Date: 09/08/04
- Next message: Zorba.GR: "Fujitsu.NetCOBOL.Suite.v7.0L10.Enterprise.Edition.WinALL.Incl.Keymaker.REPACK, Mobile.BASIC.v2.1.Incl.Keymaker, PureBasic.v3.91.LiNUX, PureBasic.v3.91.WinALL,"
- Previous message: Robert Wagner: "Re: Automatic detection of a COBOL dialect ?"
- In reply to: diesmo: "Automatic detection of a COBOL dialect ?"
- Next in thread: Robert Wagner: "Re: Automatic detection of a COBOL dialect ?"
- Reply: Robert Wagner: "Re: Automatic detection of a COBOL dialect ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 08 Sep 2004 18:30:02 +0100
On 8 Sep 2004 08:37:32 -0700, partoche@caramail.com (diesmo) wrote:
>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 :) ).
This is an incorrect assumption.
If you have
ABCD IDENTIFICATION DIVISION.
PROGRAM-ID. testing.
ENVIRONMENT DIVISION.
EFGH DATA DIVISION.
WORKING-STORAGE SECTION.
01 V1 pic x(11) value "ABC-DEF-GHI".
PROCEDURE DIVISION.
MAIN.
DISPLAY V1.
it is fixed format and does not have any number on the 1-6 cols.
One thing that "might" work would be
if position 7 on any line contains a letter other than "D" then it is
free format, or is wrongly coded.
Now you could still have a valid free format program that just
happened to only have "D"'s on position 7. Very unlikely though.
But if you are parsing a copybook on it's own (you didn't tell us what
your parser does), then it is possible that a freeformat copybook will
have only numbers on cols 1-6.
>
>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 ?
Same vendor can use both free and fixed format. There are rules to
determine this.
>
>Thanks in advance.
>
>Regards,
>diesmo.
Frederico Fonseca
ema il: frederico_fonseca at syssoft-int.com
- Next message: Zorba.GR: "Fujitsu.NetCOBOL.Suite.v7.0L10.Enterprise.Edition.WinALL.Incl.Keymaker.REPACK, Mobile.BASIC.v2.1.Incl.Keymaker, PureBasic.v3.91.LiNUX, PureBasic.v3.91.WinALL,"
- Previous message: Robert Wagner: "Re: Automatic detection of a COBOL dialect ?"
- In reply to: diesmo: "Automatic detection of a COBOL dialect ?"
- Next in thread: Robert Wagner: "Re: Automatic detection of a COBOL dialect ?"
- Reply: Robert Wagner: "Re: Automatic detection of a COBOL dialect ?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|