[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNU-COBOL] PIC



At 12:49 PM 10/26/99 , Justin C. Ferguson wrote:

>         The functionality is not the stumbling block, at the moment.  The
>         functionality is the easy part.  The syntax is hard.  Very hard
>         to get completely correct.   The problem that's being run into is
>         that the grammar for COBOL is so complex none of the existing tools
>         can handle it.  Tim Josling has done a lot of work on a preprocessor,
>         which is an excellent start towards getting this done, but it
>         still leaves us a lot of difficult steps ahead.

Correct, every item of Cobol functionality is relatively easy to implement, 
though some are tediously detailed.  The most tedious of all is PICTURE.

The Cobol descriptive syntax predates formal grammars (much less lexical 
parsing tools).  Dozens of syntactic elements are not in the diagrams at 
all, but in the syntax rules.

I think David's concept of a Perl-script generating back end is feasible, 
though it will take more than 10 hours to implement, even once the parsing 
job is complete.

Which brings up a question:  Has anyone written a Cobol edit program?  In 
olden times, when I wrote mainframe compilers, we were always compiling for 
specific edit op-codes, and the details were always different.  Failing to 
customize your PIC handling for the features and deficiencies of the 
underlying edit language was a tremendous performance hit.

Performance of an edit routine is no longer an issue, especially in an 
interpretive back end.  What we need is a standard program something like this:

     edit <value> <pic> [-b] [-s[l|t][s]]
     where
         <value> is a decimal value
         <pic> is a (hopefully) valid picture
         -b is BLANK WHEN ZERO
         -s is SIGN LEADING|TRAILING [SEPARATE]
     and the output is the edited string.

It will take more than 10 hours to implement this program.  We also need a 
de-edit program.  A more generalized MOVE interface would also be useful, 
but it could be built on top of edit and de-edit.  A vague syntax would be

     move <source-description> <target-description> <value>

I'm putting the value at the end because it can contain any character.  I 
may be necessary to pass it hex encoded anyway.  Source-description and 
target-description are some brilliant encoding for PIC and all relevant 
clauses.
--
RB |\  Randall Bart
aa |/  Barticus@usa.net 818-985-3259 Barticus@att.net
nr |\  8321 Burnet Av #1, North Hills, CA 91343
dt ||\
a   |/ Y2K website:    http://users.aol.com/PanicYr00
l   |\
l   |/ DOT-HS-808-065     I Love You    MS^7=6/28/107


--
This message was sent through the gnu-cobol mailing list.  To remove yourself
from this mailing list, send a message to majordomo@lusars.net with the
words "unsubscribe gnu-cobol" in the message body.  For more information on
the GNU COBOL project, send mail to gnu-cobol-owner@lusars.net.