Cobol/DB2 - highlighting SQL instructions

Cobol/DB2 - highlighting SQL instructions

4
NewbieNewbie
4

    Jan 30, 2009#1

    Hi,

    I try to highlight Cobol/DB2 language, but I have a problem. When I insert an SQL instruction, each instruction should have the same color. All SQL instructions begin with "Exec SQL" and stop with "END-EXEC".
    I want that everything between these two codes has the same color. Is this possible?

    Sorry my bad English.

    6,602548
    Grand MasterGrand Master
    6,602548

      Jan 30, 2009#2

      Yes, with highlighting SQL instructions as alternate block comment if the Cobol syntax highlighting does not make use already of the alternate block comment highlighting.

      Open the syntax highlighting wordfile you currently use and scroll down to the line starting with something like /Lx"Cobol with x is a number between 1 and 20.

      Insert in this line left of File Extensions = following:

      Block Comment On Alt = SQL Block Comment Off Alt = END-EXEC

      Then everything from word "SQL" to word "END-EXEC" is highlighted with the color for alternate block comments.

      Unfortunately "Exec SQL" cannot be specified as alternate block comment starting string because it contains the space character which is always a word delimiter. Therefore a definition like

      Block Comment On Alt = Exec SQL Block Comment Off Alt = END-EXEC

      is not possible. If the word "Exec" exists only left to "SQL", you can use Exec as alternate block comment starting string instead of SQL. But I guess that is not the case.
      Best regards from an UC/UE/UES for Windows user from Austria

      4
      NewbieNewbie
      4

        Jan 30, 2009#3

        Hi,
        thanks, works fine.
        Other question: in JCL, when a line does not begin with /, / has a different color. Can I do this in UE too?

        6,602548
        Grand MasterGrand Master
        6,602548

          JCL - highlighting lines not starting with //

          Jan 30, 2009#4

          According to JCL Quick Reference a line comment in JCL must be //* at start of a line. So in your wordfile you should have on the language definition file for JCL:

          Line Comment = //* Line Comment Valid Columns = [1]

          Further I could see on the JCL Quick Reference page that normally all lines start with // and I'm quite sure / can also exist in formulas. Highlighting a character (word) depending on the position in the line is not possible.

          If the character / is not listed in the list of characters at /Delimiters = and in the wordfile you have something like:

          /C1"Statements"
          ** //
          // //
          /C2"Operators"
          // /


          the answer is YES, if / as operator is surrounded always by delimiter characters in your JCL files because it is itself not a word delimiter. Otherwise the answer is NO.
          Best regards from an UC/UE/UES for Windows user from Austria

          4
          NewbieNewbie
          4

            Re: JCL - highlighting lines not starting with //

            Jan 30, 2009#5

            Thanks for the answer, but now that I read your answer I realized that I wrote the wrong question :s
            What I meant was: When a line does not begin with //, the entire line should have a different color.
            Is this possible?

            Usually, when a line does not begin with //, it begins with spaces.

            6,602548
            Grand MasterGrand Master
            6,602548

              Re: JCL - highlighting lines not starting with //

              Jan 31, 2009#6

              No, it is not possible to highlight an entire line if it does not start with a special string.

              But highlighting an entire line with a color if it has a space in column 1 or 2 is possible when interpreting this line as line comment. Unfortunately the line comment, the alternate line comment and the block comment use the same color setting - the comments color. Only for alternate block comments a different color can be specified. But good is that the alternate block comment can be used as an additional line comment when not specifying an alternate block comment off string. So instead of

              Line Comment = //* Line Comment Valid Columns = [1]

              you would need

              Code: Select all

              Line Comment Num = 1  Line Comment Valid Columns = [1,2] Block Comment On Alt = //*
              Note the 2 spaces between = 1 and Line Comment Valid.

              With that definition if a space is found in column 1 or 2 of a line, the entire line will be highlighted with the comment color. And real comments are highlighted with the alternate block comments color. Of course the limitation of //* being only valid as line comment when starting in column 1 does not exist anymore with that definition. So if //* would exist anywhere else in the line it would be also interpreted as start of a line comment, but I guess that does not occur and therefore this is no problem.
              Best regards from an UC/UE/UES for Windows user from Austria

              4
              NewbieNewbie
              4

                Re: JCL - highlighting lines not starting with //

                Feb 02, 2009#7

                Thanks,

                Works perfectly