On Friday 14 November 2008 03:51:47 pm Tony Mechelynck wrote: > On 14/11/08 17:50, Charles Campbell wrote: > > [EMAIL PROTECTED] wrote: > >> Here is a sample of what I'm referring to: (need I say to > >> ignore the ruler line?) > >> ----+----1----+----2----+----3----+----4----+----5----+----6---- > >> +----7----+----8 > >> * This line works fine since it starts in column 7 as > >> does the next > >> *_*_*^**^*_*_* > >> > >> * The 2nd line below, while syntactically correct, is > >> flagged on the screen as being an error. > >> compute A = ((B + C) / D) > >> * ((E * F) + G) > >> > >> I acknowledge that an obvious solution at least for this > >> elementary example would be to move the > >> asterisk from where it is to the end of the previous line but > >> occassionally in real life the line is too > >> long, e.g. due to long field names, forcing the continuation as > >> above. > >> > >> Lynn > >> > >> On Nov 14, 7:01 am, Ben Schmidt<[EMAIL PROTECTED]> wrote: > >>>> In COBOL an asterisk has 2 purposes. > >>>> First if it's in column 7 it signifies that line as being a > >>>> coment. Secondly, if it appears in any colum greater than 11 > >>>> it is used as a mathamatical operator. > >>>> > >>>> The editor correctly flags the lines with the asterisk in > >>>> column 7 as a comment, however, should that character appear > >>>> anywhere else on the line it flags this line as a syntax error > >>>> which can be fairly distracting and annoying. > >>> > >>> It doesn't always mark it as an error; I can get it to appear > >>> normally, e.g. if I type 3 * 4 with a large indent. But I don't > >>> know COBOL, so I can't tell if what it's doing is right or > >>> wrong. Perhaps you could post some example code where the > >>> highlighting is wrong and explain why, and then we can help > >>> with the syntax file? The person listed as the maintainer of > >>> the syntax file may also be worth contacting. > > > > I don't really know cobol anymore (I had cobol years ago, and I'm > > glad not to need to mess with it). > > I note that a "-" in column#7 fixes the problem; in other words, > > syntax/cobol.vim expects you to use cobol's continuation > > character. > > > > Regards, > > Chip Campbell > > COBOL's continuation character should only be used (in the several > COBOL standards which I used professionally starting in 1969), if > you break a line in the middle of a word (Vim would say "in the > middle of a keyword"), or in the middle of a non-numeric literal > (which is the COBOL name for a string); in the latter case the > double-quotes must not be closed in column 72 but they must be > reopened in colum 12. If you break the line between words in a > sentence, you should not use a continuation line. > > Now a simple way to check whether the * is correctly highlighted: * > as an operator (in columns 12 to 72 of a sentence in the PROCEDURE > DIVISION) is a word (which must be separated by spaces before and > after it except after an opening paren, or before a closing paren, > comma, semicolon or period) and it is equivalent to the slightly > more verbose TIMES or, even longer, MULTIPLIED[ BY]. If an > "operator" asterisk is shown in Error highlight, what happens if > you replace just the asterisk _character_ by the word "TIMES"? > (Remember, word-separating spaces or punctuation must already exist > around the asterisk.) > > Using the example above, and remembering that I worked on computers > which didn't know about lowercase, > > COMPUTE A = ((B + C) / D) > * ((E * F) + G). > > is a perfectly valid COBOL sentence provided that it appears in the > PROCEDURE DIVISION, both its lines start no earlier than column 12 > (and end no later than column 72 in fixed-form COBOL), and that all > the data items it uses are defined in the DATA DIVISION. No > column-7 dash is required, but there must be a period followed by a > space somewhere (no later than the end of the paragraph, which is > just before the next procedure-name i.e. label) to end the > sentence. In slightly more verbose COBOL, the above sentence is > equivalent to > > COMPUTE A = ((B PLUS C) DIVIDED BY D) > MULTIPLIED BY ((E TIMES F) PLUS G. > > or even, in a somewhat older version of the standard where the > COMPUTE verb didn't exist, and with two more WORKING-STORAGE > SECTION data items of appropriate PICTURE: > > ADD B C GIVING TEMP-1. > DIVIDE D INTO TEMP-1. > MULTIPLY E F GIVING TEMP-2. > ADD G TO TEMP-2. > MULTIPLY TEMP-1 TEMP-2 GIVING A. > > > Best regards, > Tony.
Since we are talking the original fixed format, would not the problem be solved if line numbers actually appeared in columns 1-6? Writing the COBOL program that takes the source program and renumbers it is left as an exercise for the student. I have mine :<). -- John Culleton Resources for every author and publisher: http://wexfordpress.com/tex/shortlist.pdf http://wexfordpress.com/tex/packagers.pdf http://www.creativemindspress.com/newbiefaq.htm http://www.gropenassoc.com/TopLevelPages/reference%20desk.htm --~--~---------~--~----~------------~-------~--~----~ You received this message from the "vim_use" maillist. For more information, visit http://www.vim.org/maillist.php -~----------~----~----~----~------~----~------~--~---
