COBOL

COBOL

COBOL

COBOL is responsible for the efficient, reliable, secure, and unseen day-to-day operations of the world's economy.

 View Only
  • 1.  Suppressed run-time messages

    Posted Tue August 15, 2017 06:11 PM

    I seem to remember, but can no longer recall where I saw it, that some COBOL runtime messages are 'suppressed" and not written to the MSGFILE (CEEMSG).  Is this true, or am I imagining it?  If it is true, where is it documented, and why does that behavior exist?  If it is not true, I wonder what I was thinking of...

    fswarbrick


  • 2.  Re: Suppressed run-time messages

    Posted Wed August 16, 2017 12:04 PM

    I just found this in the LE Programming Guide, section "COBOL condition handling semantics".

    If an exception occurs in a COBOL program, COBOL does nothing until every condition handler at every stack frame has been interrogated.
    After all stack frames have been visited, COBOL does the following:
    1.    Checks to see if the condition has a facility ID of IGZ (is a COBOL-specific condition). If not, COBOL percolates the condition to the Language Environment condition manager.
    2.    Handles the condition based on its severity (see Table 1 for an explanation of severity codes and their meaning under Language Environment).
    If the condition severity is 1, a message describing the condition is issued to the destination specified in the MSGFILE runtime option, and processing resumes in the program in which the error occurred.
    If the severity is 2 or above, COBOL percolates the condition to the Language Environment condition manager. The Language Environment default action then takes place.

    It doesn't quite say what I was thinking I had read, so there still might be something else.  But if I am reading this correctly:

    • Severity 0 (informational): COBOL does nothing, just continues to the next statement.
    • Severity 1 (warning): COBOL writes the associated message to the MSGFILE (CEEMSG) and continues to the next statement.
    • Severity 2 and above: COBOL "percolates" the condition to LE.  LE acts depending on the value of TERMTHDACT, generally writing a message to MSGFILE and/or doing the specified type of dump, followed by a U4038 abend (or a termination of the run unit with RC=3000 if ABTERMENC(RETCODE) is set).

    Since the handling of SEV 1 is specifically called out for COBOL I am curious as to the difference with other languages.  Do other languages not write out SEV 1 warning messages to the MSGFILE?

    fswarbrick


  • 3.  Re: Suppressed run-time messages

    Posted Wed August 16, 2017 04:09 PM

    In case anyone actually reads this, I must have had it backwards.  IGZ sev 1 (warning) messages are written to the MSGLOG.  All other warnings are not.

    I wonder why that is.

    fswarbrick


  • 4.  Re: Suppressed run-time messages

    Posted Wed August 16, 2017 07:03 PM

    I cannot answer if there is such a case where some COBOL runtime messages are 'suppressed" and not written to the MSGFILE (CEEMSG), but might add my interpretation about LE Programming Guide, section "COBOL condition handling semantics". It layouts how COBOL runtime handles a condition based on the SEVs.

    • SEV0: COBOL does nothing(nothing in a sense that no condition handling is needed), still writes it to MSGFILE
    • SEV1: COBOL needs to handle the signal and writes it to MSGFILE
    • SEV2 and above: COBOL percolates it and LE handles it (for example, TERMTHDACT(QUIET) does not write the SEV2 and above messages to MSGFILE while TERMTHDACT(MSG) does)

    The following program results in a warning and a severe message and demonstrates above. 
     

    JCL

    PARM='/ter(quiet),MSGFILE(MINE),BADOPT'

    ...

    MINE     DD DSN=<HLQ>.DATAFILE,DISP=SHR   

     

    COBOL

            IDENTIFICATION DIVISION.          
            PROGRAM-ID. 'A'.                  
            ENVIRONMENT DIVISION.             
            DATA DIVISION.                    
            WORKING-STORAGE SECTION.          
              01 a1 pic 999 binary.           
                                              
            PROCEDURE DIVISION.               
            BEGIN.                            
          *     IGZ0049W                      
                compute a1 = a1 ** 0          
                                              
          *     GO TO will result in IGZ0037S 
                go to BEGIN2                  
                                              
                stop run.                     
                                              
            BEGIN2.                           
                display " ".                  
                                              
            END PROGRAM A.                    

     

    "Language Environment Programming Reference", MSGFILE states:

    MSGFILE specifies the ddname and attributes of the data set (message file) where 
    Language Environment directs the following output: 
    v All Language Environment messages 
    v Reports generated by the RPTOPTS and RPTSTG run-time options 
    v Output produced by the CEEMSG and CEEMOUT callable services

    It sounds to me other languages also follow the same practice; that is, all SEV 0/1 go to MSGFILE and SEV2/above is controlled by TERM(...)

    Roy Bae


  • 5.  Re: Suppressed run-time messages

    Posted Wed August 16, 2017 07:28 PM

    I'm not sure why that documentation leads you to believe that SEV 0 (informational) messages are written to MSGFILE.  It specifically only mentions that SEV 1 messages are.

    Seeing as how there appears to be only one SEV 0 IGZ message (IGZ0263I   The previous condition has also occurred in program prograrm-name on line(s): line-numbers.), and I don't know how to cause it, I'm not going to try to prove it one way or the other.

    I also disagree with what seems to be your interpretation of "All Language Environment Messages".  I believe you are thinking that all conditions cause messages to be written.  I am thinking that only some conditions do, but if they are written they are written to MSG file.  I know for sure that CEE SEV 0 and SEV 1 messages are not written to the MSGFILE.  For example, if you have any SEV 0 or SEV 1 conditions occur then at run-unit termination a "CEE0199W  The termination of a thread was signaled due to a STOP statement" condition is raised.  But this SEV 1 condition does not cause a message to be written to the MSGFILE.  I haven't been able to create any other CEE SEV 1 messages to see their behavior.

    fswarbrick