Logging syntax errors detected in COBOL input files

This topic describes an option that causes the Enterprise Service Tools source code generator to validate the syntax of your input COBOL source file and its included files, and, if any syntax errors are detected, to log the appropriate COBOL error information in a XML data structure that is stored in an XML file whose file path you specify when you enable this option. This option is available only when you generate a Web service using the bottom-up method and using the batch processor in a single-service project.

This option is available in the command-line batch processor by specifying the value com.ibm.etools.xmlent.ui.GEN_ERROR_FEEDBACK_FILE_PATH for the name attribute in a CodeGenProperty element (see CodegenProperty).

The following block of XML text shows the XML DTD for the structure in which the Enterprise Service Tools source code generator stores the COBOL syntax error information:
<?xml version="1.0" encoding="UTF-8"?>
<!ELEMENT BUILD (PACKAGE)*>
<!ELEMENT PACKAGE (FILEREFERENCETABLE,(MESSAGE)*)>
<!ELEMENT FILEREFERENCETABLE (FILECOUNT,FILE+)>
<!ELEMENT MESSAGE (MESSAGENUMBER,MESSAGETEXT,MESSAGELINE?,MESSAGEFILE?)>
<!ELEMENT FILE (FILENUMBER,FILENAME,INCLUDEDFROMFILE?,INCLUDEDONLINE?)>
<!ELEMENT MESSAGENUMBER (#PCDATA)>
<!ELEMENT MESSAGELINE (#PCDATA)>
<!ELEMENT MESSAGEFILE (#PCDATA)>
<!ELEMENT MESSAGETEXT (#PCDATA)>
<!ELEMENT FILECOUNT (#PCDATA)>
<!ELEMENT FILENUMBER (#PCDATA)>
<!ELEMENT FILENAME (#PCDATA)>
<!ELEMENT INCLUDEDFROMFILE (#PCDATA)>           <!-- NOT GENERATED!! -->
<!ELEMENT INCLUDEDONLINE (#PCDATA)>             <!-- NOT GENERATED!! -->
Note: The generated error information does not generate the last two XML elements listed shown:
<!ELEMENT INCLUDEDFROMFILE (#PCDATA)>           <!-- NOT GENERATED!! -->
<!ELEMENT INCLUDEDONLINE (#PCDATA)>             <!-- NOT GENERATED!! -->
The following is a sample XML file generated using the XML DTD previously described.
<?xml version="1.0" encoding="UTF-8"?>
<BUILD>
  <PACKAGE>
    <FILEREFERENCETABLE>
      <FILECOUNT>1</FILECOUNT>
      <FILE>
        <FILENUMBER>0</FILENUMBER>
        <FILENAME>c:\mycobol\MYFILE_01.cbl</FILENAME>
      </FILE>
    </FILEREFERENCETABLE>
    <MESSAGE>
      <MESSAGENUMBER>IGYPA3063-S</MESSAGENUMBER>
      <MESSAGETEXT>"CALL" or "CANCEL" identifier "CALLDN (ALPHANUMERIC-EDITED)" 
         was not alphanumeric, zoned decimal nor alphabetic. The statement was
         discarded.</MESSAGETEXT>
      <MESSAGELINE>228</MESSAGELINE>
      <MESSAGEFILE>0</MESSAGEFILE>
    </MESSAGE>
  </PACKAGE>
</BUILD>
The following table describes the elements in the XML DTD:
Element: Description:
FILEREFERENCETABLE This element contains a description of each source file in which a COBOL syntax has occurred.
FILECOUNT This element specifies the number of files in the FILEREFERENCETABLE element.
FILE This element describes one file in the FILEREFERENCETABLE element.
FILENUMBER This element specifies an integer identifier for the file being described in a FILE element.
FILENAME This element specifies the location of the file being described in a FILE element.
MESSAGE This element describes a COBOL syntax error that was encountered in the source file.
MESSAGENUMBER This element contains the message number of the syntax error being described in a MESSAGE element.
MESSAGETEXT This element contains the message text of the syntax error being described in a MESSAGE element.
MESSAGELINE This element contains the number of the line in which the syntax error being described was detected.
MESSAGEFILE This element contains the identifying file number of the COBOL source file in which the syntax error being described was detected. This number - an integer - is the identifying file number that was specified for this file in the FILENUMBER element of the FILE element.

You should be aware of the following features when you use this option:
  • The source code generator validates not only the COBOL source code file that you specify, but also any COBOL copybook files that are included in the COBOL source file that you specify.
  • No output file is generated unless a COBOL syntax error is detected.
You should be aware of the following limitations when you use this option:
  • This option is available only for COBOL source code.
  • The source code generator records only files that contain COBOL syntax errors. Files that do not contain COBOL syntax errors are not included in the generated XML structure.