COBOL syntax

2006-03-09
2012-11-14
  • Nobody/Anonymous

    Hi,
    Is there any one who knows if there is a syntax higlighting option for COBOL language within Notepad ++, or how to do it ?

     
    • Nobody/Anonymous

      Language is not the issue. Language is never the issue. Technoid bigots, now they're different.

      The good news is... their limits are so glaring, they pose no real obstacle to thought.

       
    • Nobody/Anonymous

      99% of banking-software is still written in cobol, at least in Spain

       
    • Marcelo da Silva

      Someone could answer the question?

       
      • Martijn Coppoolse

        > By: Marcelo da Silva (m4rc310227) - 2007-01-25 15:46
        > Someone could answer the question?

        Good point. Whether or not COBOL is has a future is not the point; users apparently need it.

        Personally, I don't know zilch about COBOL.  AFAIK, there's two things you could try to create a language definition for it:

        * Create a User-Defined language
          - Open the "User Define" dialog (in the View menu, just above the zooming options)
          - In the dialog, press 'Create New' and enter 'COBOL'.
          - For testing purposes, you might want to dock the window, open a COBOL file in the editor, select COBOL from the Language menu (where it should now appear). As you make your changes to the language definition, you'll see those changes immediately reflected in the document.
          - Check the 'ignore case' if it doesn't matter to the COBOL language whether keywords are written in small or CAPITAL letters.
          - Enter the extension for files containing COBOL (would that be COB?)
          - On the first tab, you can enter the default style setting for the COBOL highlighter (something like Courier New, green on black?). If you want, you can also specify which keywords will indicate the start or end of a folding section, and define specific styles for those keywords.  From what I gather, the "full stop" or point character (".") would indicate the closure of a folding section; however this doesn't seem to get picked up, so folding might not work this way.
          - On the second tab ("Keyword Lists"), you can define lists of keywords, and the font and style for those keywords. There's room for four categories of keywords, you'll have to pick a categorisation that makes sense for the language.
          - On the third tab ("Comment & Number"), you can specify what indicates a comment (I think that would be the * asterisk), and if COBOL supports comment blocks (i.e. comments that span multiple lines), you can specify those as well. Numbers also get to have their own style.
          - Last but not least, the last tab allows you to indicate which characters should be considered to be operators, and so not be included with the words they accompany. Do include the "." dot, otherwise it will be included with any keyword it happens to follow -- which will mean the keyword doesn't get recognized.  Here you can also specify delimiters, usually the characters used to delimit strings.

        Based on a few samples I found on the internet, here's the keyword lists I could figure out:

        ACCEPT ACCESS ADD ASSIGN AT
        BY
        CALL CHARACTERS CLOSE COLUMN COMPUTE CONVERSION CORRESPONDING
        DELETE DESCRIPTOR DISPLAY DIVIDE
        ELSE END
        ERASE EXIT
        FD FROM
        GIVING GO
        IF INVALID IS
        KEY
        LINE
        MODE MOVE MULTIPLY
        NEXT
        OF OPEN ORGANIZATION
        PERFORM PIC
        READ RECORD REMAINDER
        SCREEN SEARCH SELECT SET START SUBTRACT
        THEN THRU TO
        UNTIL USING
        VALUE VARYING
        WHEN WITH WRITE
        ===
        AND
        DYNAMIC
        I-O INDEXED INPUT
        NOT NUMERIC
        OR OUTPUT
        POSITIVE
        SPACES
        ===
        DATA DIVISION
        ENVIRONMENT
        FILE FILE-CONTROL
        IDENTIFICATION INPUT-OUTPUT
        PROCEDURE PROGRAM-ID
        SECTION
        WORKING-STORAGE

        I'm sure you can complete those.  It's not actually necessary to group the keywords by first letter, but it doesn't hurt either, and it makes it easier to find a keyword... :-)
        And the operators I selected were ( ) . + < = > and seemed to work fine.  I didn't include the minus or dash ("-"), since that's part of some keywords, and those keywords wouldn't get recognized correctly if "-" was defined as an operator.

        * Alternatively, you could look into the files langs.xml and stylers.xml in your %AppData%\Notepad++ folder and/or the folder containing Notepad++.exe, see if you can figure out how those work, and adapt them.  Do bear in mind that they'll probably be overwritten when you install the next update of Npp, though!

         
    • Nobody/Anonymous

      A definition file for COBOL, so that Notepad++ would support it would be great !

      I work in the Biggest Bank in my country, I'm a programmer and am working here in a big multinational consulting firm, we use COBOL everyday, it's never going to die and we need good tools for it !

      We are using IBM's tools like TSO, but also some paid software like UltraEdit32, but we would gladly change to Notepad++ if it supported the language !

      Best Regards

       
    • Nobody/Anonymous

      Cobol is dead

       
      • Hans Ajiet Holtkamp

        Not that I like cobol, but this is wrong. Period.

        80% of banking-software is still written in cobol, at least in Europe.

         
        • Nobody/Anonymous

          As well a Medical IT systems.  Companies are even continuing to invest in new functionality for these ancient technologies.

           
          • Nobody/Anonymous

            There are ~200 millions new code-lines written in cobol every year.
            seems to me not to be dead too;)

             
            • Nobody/Anonymous

              Please don't argue if cobol is dead or not,
              can somebody helps with this request, giving
              a cobol syntax higlighting .

              Thanks.

               
              • Nobody/Anonymous

                The following is the COBOL configuration used by me. Hope it can help.
                BTW, I need some help with keywords. I mean, keywords with more than one word.
                e.g. "WORKING-STORADE SECTION", "PROCEDURE DIVISION" "EXEC SQL".
                Especially related to  BlockBegin & blockEnd.

                humm... Even COBOL is dead he is still paying my bills. Sorry! I can't help!

                FOLDER & DEFAULT
                blockBegin
                IF
                EVALUATE
                STRING
                SQL

                blockEnd
                END-EVALUATE
                END-STRING
                END-IF
                END-EXEC

                KEYWORDS LISTS (Do not use prefix mode)
                <Keywords name="Words1">
                AUTHOR.
                CLASS-CONTROL
                CLASS-ID
                CLASS-OBJECT
                CONFIGURATION
                DATA
                DATE-COMPILED.
                DATE-WRITTEN.
                DIVISION.
                ENVIRONMENT
                EXIT
                FD
                FILE
                FILE-CONTROL.
                FILE-ID
                IDENTIFICATION
                INPUT-OUTPUT
                INSTALLATION.
                LINKAGE
                LOCAL-STORAGE
                METHOD-ID
                OBJECT
                OBJECT-COMPUTER.
                OBJECT-STORAGE
                PROCEDURE
                PROGRAM-ID.
                SCREEN
                SECTION.
                SOURCE-COMPUTER.
                SPECIAL-NAMES.
                WORKING-STORAGE

                <Keywords name="Words2">
                ACCEPT
                ACCESS
                ADD
                ASSIGN
                AUTO
                BACKGROUND-COLOR
                BLANK
                CALL
                CLOSE
                COLUMN
                COMPUTE
                COPY
                DATE
                DISK
                DISPLAY
                ELSE
                END-ADD
                END-COMPUTE
                END-PERFORM
                END-READ
                END-SEARCH
                END-SUBTRACT
                ENTER
                FOREGROUND-COLOR
                GO
                HIGHLIGHT
                INHERITS
                INITIALIZE
                INSPECT
                INVOKE
                LEFT-JUSTIFY
                LINE
                MODE
                MOVE
                OBJECT-STORAGE
                OPEN
                ORGANIZATION
                PERFORM
                PRIVATE
                READ
                REFERENCE
                RUN
                SELECT
                SELF
                SIZE
                START
                STOP
                SUBTRACT
                WHEN
                WRITE

                <Keywords name="Words3">
                AS
                AT
                BY
                CHAR
                CHARACTER
                CHARACTERS
                COMP
                COMP-0
                COMP-1
                COMP-2
                COMP-3
                COMP-4
                COMP-5
                CONTAINS
                DYNAMIC
                FILLER
                FOR
                FROM
                GIVING
                I-O
                INDEXED
                INPUT
                INVALID
                IS
                KEY
                LOW-VALUE
                LOW-VALUES
                METHOD
                NEXT
                OCCURS
                OF
                OUTPUT
                PIC
                PICTURE
                PROGRAM
                RECORD
                REDEFINES
                RELATIVE
                REPLACING
                RETURNING
                SENTENCE
                SEQUENTIAL
                SPACE
                SPACES
                STATUS
                THRU
                TO
                UNTIL
                USING
                VALUE
                VARYING
                WITH
                ZERO
                ZEROES
                ZEROS

                <Keywords name="Words4">
                AND
                EQUAL
                FUNCTION
                GREATER
                INSPECT
                LESS
                NOT
                OR
                OTHER
                REPLACING
                THAN

                COMMENT & NUMBER
                Comment line (Treat keyword as Symbol)
                * /
                Comment Block (Treat keyword as Symbols)
                * /
                * /

                OPERATORS
                (
                )
                .
                <
                =
                >

                Delimiter 1
                open(
                close)

                Delimiter 2
                The following is the COBOL configuration used by me. Hope it can help.
                BTW, I need some help with keywords. I mean, keywords with more than one word.
                e.g. "WORKING-STORADE SECTION", "PROCEDURE DIVISION" "EXEC SQL".
                Especially related to  BlockBegin & blockEnd.

                humm... Even COBOL is dead he is still paying my bills. Sorry! I can't help!

                FOLDER & DEFAULT
                blockBegin
                IF
                EVALUATE
                STRING
                SQL

                blockEnd
                END-EVALUATE
                END-STRING
                END-IF
                END-EXEC

                KEYWORDS LISTS (Do not use prefix mode)
                <Keywords name="Words1">
                AUTHOR.
                CLASS-CONTROL
                CLASS-ID
                CLASS-OBJECT
                CONFIGURATION
                DATA
                DATE-COMPILED.
                DATE-WRITTEN.
                DIVISION.
                ENVIRONMENT
                EXIT
                FD
                FILE
                FILE-CONTROL.
                FILE-ID
                IDENTIFICATION
                INPUT-OUTPUT
                INSTALLATION.
                LINKAGE
                LOCAL-STORAGE
                METHOD-ID
                OBJECT
                OBJECT-COMPUTER.
                OBJECT-STORAGE
                PROCEDURE
                PROGRAM-ID.
                SCREEN
                SECTION.
                SOURCE-COMPUTER.
                SPECIAL-NAMES.
                WORKING-STORAGE

                <Keywords name="Words2">
                ACCEPT
                ACCESS
                ADD
                ASSIGN
                AUTO
                BACKGROUND-COLOR
                BLANK
                CALL
                CLOSE
                COLUMN
                COMPUTE
                COPY
                DATE
                DISK
                DISPLAY
                ELSE
                END-ADD
                END-COMPUTE
                END-PERFORM
                END-READ
                END-SEARCH
                END-SUBTRACT
                ENTER
                FOREGROUND-COLOR
                GO
                HIGHLIGHT
                INHERITS
                INITIALIZE
                INSPECT
                INVOKE
                LEFT-JUSTIFY
                LINE
                MODE
                MOVE
                OBJECT-STORAGE
                OPEN
                ORGANIZATION
                PERFORM
                PRIVATE
                READ
                REFERENCE
                RUN
                SELECT
                SELF
                SIZE
                START
                STOP
                SUBTRACT
                WHEN
                WRITE

                <Keywords name="Words3">
                AS
                AT
                BY
                CHAR
                CHARACTER
                CHARACTERS
                COMP
                COMP-0
                COMP-1
                COMP-2
                COMP-3
                COMP-4
                COMP-5
                CONTAINS
                DYNAMIC
                FILLER
                FOR
                FROM
                GIVING
                I-O
                INDEXED
                INPUT
                INVALID
                IS
                KEY
                LOW-VALUE
                LOW-VALUES
                METHOD
                NEXT
                OCCURS
                OF
                OUTPUT
                PIC
                PICTURE
                PROGRAM
                RECORD
                REDEFINES
                RELATIVE
                REPLACING
                RETURNING
                SENTENCE
                SEQUENTIAL
                SPACE
                SPACES
                STATUS
                THRU
                TO
                UNTIL
                USING
                VALUE
                VARYING
                WITH
                ZERO
                ZEROES
                ZEROS

                <Keywords name="Words4">
                AND
                EQUAL
                FUNCTION
                GREATER
                INSPECT
                LESS
                NOT
                OR
                OTHER
                REPLACING
                THAN

                COMMENT & NUMBER
                Comment line (Treat keyword as Symbol)
                * /
                Comment Block (Treat keyword as Symbols)
                * /
                * /

                OPERATORS
                (
                )
                .
                <
                =
                >

                Delimiter 1
                Boundary open(
                Boundary close)

                Delimiter 2
                Boundary open"
                Boundary close"

                 
                • Nobody/Anonymous

                  As expected. Some fine tuning. Sorry for the mistakes.

                  FOLDER & DEFAULT
                  blockBegin
                  IF
                  EVALUATE
                  STRING
                  SQL

                  blockEnd
                  END-EVALUATE
                  END-STRING
                  END-IF
                  END-EXEC

                  KEYWORDS LISTS (Do not use prefix mode)
                  <Keywords name="Words1">
                  AUTHOR
                  CLASS-CONTROL
                  CLASS-ID
                  CLASS-OBJECT
                  CONFIGURATION
                  DATA
                  DATE-COMPILED
                  DATE-WRITTEN
                  DECLARE
                  DIVISION
                  ENVIRONMENT
                  EXIT
                  FD
                  FILE
                  FILE-CONTROL
                  FILE-ID
                  IDENTIFICATION
                  INPUT-OUTPUT
                  INSTALLATION
                  LINKAGE
                  LOCAL-STORAGE
                  METHOD-ID
                  OBJECT
                  OBJECT-COMPUTER
                  OBJECT-STORAGE
                  PROCEDURE
                  PROGRAM-ID
                  SCREEN
                  SECTION
                  SOURCE-COMPUTER
                  SPECIAL-NAMES
                  WORKING-STORAGE

                  <Keywords name="Words2">
                  ACCEPT
                  ACCESS
                  ADD
                  ASSIGN
                  AUTO
                  BACKGROUND-COLOR
                  BLANK
                  CALL
                  CLOSE
                  COLUMN
                  COMPUTE
                  COPY
                  DATE
                  DISK
                  DISPLAY
                  ELSE
                  END-ADD
                  END-COMPUTE
                  END-PERFORM
                  END-READ
                  END-SEARCH
                  END-SUBTRACT
                  ENTER
                  FOREGROUND-COLOR
                  GO
                  HIGHLIGHT
                  INHERITS
                  INITIALIZE
                  INSPECT
                  INVOKE
                  LEFT-JUSTIFY
                  LINE
                  MODE
                  MOVE
                  OBJECT-STORAGE
                  OPEN
                  ORGANIZATION
                  PERFORM
                  PRIVATE
                  READ
                  REFERENCE
                  RUN
                  SELECT
                  SELF
                  SIZE
                  START
                  STOP
                  SUBTRACT
                  WHEN
                  WRITE

                  <Keywords name="Words3">
                  AS
                  AT
                  BY
                  CHAR
                  CHARACTER
                  CHARACTERS
                  COMP
                  COMP-0
                  COMP-1
                  COMP-2
                  COMP-3
                  COMP-4
                  COMP-5
                  CONTAINS
                  DYNAMIC
                  FILLER
                  FOR
                  FROM
                  GIVING
                  I-O
                  INDEXED
                  INPUT
                  INVALID
                  IS
                  KEY
                  LOW-VALUE
                  LOW-VALUES
                  METHOD
                  NEXT
                  OCCURS
                  OF
                  OUTPUT
                  PIC
                  PICTURE
                  PROGRAM
                  RECORD
                  REDEFINES
                  RELATIVE
                  REPLACING
                  RETURNING
                  SENTENCE
                  SEQUENTIAL
                  SPACE
                  SPACES
                  STATUS
                  THRU
                  TO
                  UNTIL
                  USING
                  VALUE
                  VARYING
                  WITH
                  ZERO
                  ZEROES
                  ZEROS

                  <Keywords name="Words4">
                  AND
                  EQUAL
                  FUNCTION
                  GREATER
                  INSPECT
                  LESS
                  NOT
                  OR
                  OTHER
                  REPLACING
                  THAN

                  COMMENT & NUMBER
                  Comment line (Treat keyword as Symbol)
                  * /
                  Comment Block (Treat keyword as Symbols)
                  * /
                  * /

                  OPERATORS
                  (
                  )
                  .
                  <
                  =
                  >

                  Delimiter 1
                  Boundary open(
                  Boundary close)

                  Delimiter 2
                  Boundary open"
                  Boundary close"

                   
        • acesword

          acesword - 2007-04-25

          ACCEPT ACCESS ACTIVE-CLASS ADD ADDRESS ADVANCING AFTER ALIGNED ALL ALLOCATE ALPHABET ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALSO ALTER ALTERNATE AND ANY ANYCASE APPLY ARE AREA AREAS AS ASCENDING ASSIGN AT AUTHOR AUTOMATIC B-AND B-NOT  B-OR B-XOR BASED BASIS BEFORE BEGINNING BINARY BINARY-CHAR BINARY-DOUBLE BINARY-LONG BINARY-SHORT BIT BLANK BLOCK BOOLEAN BOTTOM BY CALL CANCEL CBL CD CF   CH CHARACTER CHARACTERS CLASS CLASS-ID CLOCK-UNITS CLOSE COBOL CODE CODE-SET COL COLLATING COLS COLUMN COLUMNS COM-REG COMMA COMMON  COMMUNICATION COMP COMP-1 COMP-2 COMP-3 COMP-4 COMP-5 COMPUTATIONAL COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 COMPUTE    CONDITION CONFIGURATION CONSTANT CONTAINS CONTENT CONTINUE CONTROL CONTROLS CONVERTING  COPY CORR CORRESPONDING COUNT CRT CURRENCY CURSOR DATA DATA-POINTER DATE DATE-COMPILED DATE-WRITTEN  DAY DAY-OF-WEEK  DBCS DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2   DEBUG-SUB-3 DEBUGGING DECIMAL-POINT DECLARATIVES DEFAULT DELETE DELIMITED DELIMITER DEPENDING DESCENDING DESTINATION DETAIL DISABLE DISPLAY DISPLAY-1 DIVIDE DIVISION DOWN DUPLICATES DYNAMIC EC EGCS EGI EJECT ELSE EMI ENABLE END END-ACCEPT END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY END-DIVIDE END-EVALUATE END-IF END-INVOKE END-MULTIPLY END-OF-PAGE     END-PERFORM END-READ END-RECEIVE END-RETURN END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT END-UNSTRING END-WRITE END-XML ENDING ENTER ENTRY ENVIRONMENT EO EOP EQUAL ERROR ESI EVALUATE EVERY EXCEPTION EXCEPTION-OBJECT EXECUTE EXIT EXTEND EXTERNAL FACTORY FALSE FD FILE FILE-CONTROL FILLER FINAL FIRST FLOAT-EXTENDED FLOAT-LONG FLOAT-SHORT FOOTING FOR FORMAT FREE FROM FUNCTION FUNCTION-ID FUNCTION-POINTER GENERATE GET GIVING GLOBAL GO GOBACK GREATER GROUP GROUP-USAGE    HEADING HIGH-VALUE  HIGH-VALUES I-O I-O-CONTROL ID IDENTIFICATION IF IN INDEX INDEXED INDICATE INHERITS INITIAL INITIALIZE INITIATE INPUT INPUT-OUTPUT INSERT INSPECT INSTALLATION INTERFACE INTERFACE-ID INTO INVALID INVOKE IS JNIENVPTR JUST JUSTIFIED KANJI KEY LABEL LAST LEADING     LEFT LENGTH LESS LIMIT LIMITS LINAGE LINAGE-COUNTER LINE LINE-COUNTER LINES LINKAGE LOCAL-STORAGE LOCALE LOCK LOW-VALUE LOW-VALUES MEMORY MERGE MESSAGE METHOD METHOD-ID MINUS MODE MODULES MORE-LABELS MOVE MULTIPLE MULTIPLY NATIONAL NATIONAL-EDITED NATIVE NEGATIVE NESTED NEXT NO NOT NULL NULLS NUMBER NUMERIC NUMERIC-EDITED OBJECT OBJECT-COMPUTER OBJECT-REFERENCE OCCURS OF OFF OMITTED ON OPEN OPTIONAL OPTIONS OR ORDER ORGANIZATION OTHER OUTPUT OVERFLOW OVERRIDE PACKED-DECIMAL PADDING PAGE PAGE-COUNTER PASSWORD PERFORM PF PH PIC PICTURE PLUS POINTER POSITION POSITIVE PRESENT PREVIOUS PRINTING PROCEDURE PROCEDURE-POINTER PROCEDURES PROCEED PROCESSING PROGRAM PROGRAM-ID PROGRAM-POINTER PROPERTY PROTOTYPE PURGE QUEUE QUOTE QUOTES RAISE RAISING RANDOM  RD READ READY RECEIVE RECORD RECORDING RECORDS RECURSIVE REDEFINES REEL REFERENCE REFERENCES RELATIVE RELEASE RELOAD REMAINDER REMOVAL RENAMES REPLACE REPLACING REPORT REPORTING REPORTS REPOSITORY RERUN RESERVE RESET RESUME RETRY RETURN RETURN-CODE RETURNING REVERSED REWIND REWRITE RF RH RIGHT ROUNDED  RUN SAME SCREEN SD SEARCH SECTION SECURITY SEGMENT SEGMENT-LIMIT SELECT SELF SEND SENTENCE  SEPARATE  SEQUENCE  SEQUENTIAL SERVICE SET SHARING SHIFT-IN SHIFT-OUT SIGN SIZE SKIP1 SKIP2 SKIP3 SORT SORT-CONTROL SORT-CORE-SIZE SORT-FILE-SIZE SORT-MERGE SORT-MESSAGE SORT-MODE-SIZE SORT-RETURN SOURCE SOURCE-COMPUTER SOURCES SPACE SPACES SPECIAL-NAMES SQL STANDARD STANDARD-1 STANDARD-2 START STATUS STOP STRING SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUB-SCHEMA SUBTRACT SUM SUPER SUPPRESS SYMBOLIC SYNC SYNCHRONIZED SYSTEM-DEFAULT TABLE TALLY TALLYING TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TITLE TO TOP TRACE TRAILING TRUE TYPE TYPEDEF UNIT UNIVERSAL UNLOCK UNSTRING UNTIL UP UPDATE UPON USAGE USE USER-DEFAULT USING VAL-STATUS VALID VALIDATE VALIDATE-STATUS VALUE VALUES VARYING WHEN WHEN-COMPILED WITH WORDS WORKING-STORAGE WRITE WRITE-ONLY XML XML-CODE XML-EVENT XML-NTEXT XML-TEXT ZERO ZEROES ZEROS

          ** EIB DFH ABCODE ABEND CICS COMMAREA DELAY ECADDR END-EXEC ERASE EVENT EXEC FREEKB HANDLE POST REQID RESP RESP2 SECONDS SYNCPOINT TRANSID WAIT WHERE

          Hi,this is the Cobol keywords which I collect from internet.You can config it in NotePad++.

           
    • Nobody/Anonymous

      I WOULD BE INTERESTED IN COBOL HIGLIGHTING TOO.

      SORRY FOR THE CAPS. I'M NOT SCREAMING, I WAS DOING COBOL ;)