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.  CICS program to display in SYSOUT or CONSOLE

    Posted Mon August 21, 2023 11:20 AM

    Hello,

    I have little COBOL experience but I'm trying to write a program that will connect the CICS region to MQ when it gets disconnected. The program is ran via a transaction which is triggered via a policy. I would like to display a message in the syslog, console, or sysout so that automation can notify us that the attempt was made. 

    EXEC CICS SET MQCONN
              CONNECTED 
    END-EXEC.           

    I have tried the following and can't seem to find it anywhere. Any ideas or places I should look to?

    DISPLAY '    ' UPON CONSOLE 

    DISPLAY '   ' UPON SYSOUT

    DISPLAY 'RACQMQCN' mqconn-name 'CONNECTION ACQUIRE CG23'



    ------------------------------
    Christian Gonzalez
    ------------------------------


  • 2.  RE: CICS program to display in SYSOUT or CONSOLE

    Posted Mon August 21, 2023 01:01 PM

    I'm sure there are folks with far more experience and knowledge on this than me, but here's a starting point for you:

    First, you shouldn't use DISPLAY in a CICS-COBOL program.  See Functions and statements that cannot be used.

    Second, you may be able to use something like EXEC CICS WRITE OPERATOR to get a message to the operator console and SYSLOG.

    Scott



    ------------------------------
    Scott Fagen
    Mainframe Evangelist
    CDW
    www.cdw.com/content/cdw/en/solutions/ibm-zsystems.html
    ------------------------------



  • 3.  RE: CICS program to display in SYSOUT or CONSOLE

    Posted Mon August 21, 2023 01:17 PM
    Edited by Christian Gonzalez Mon August 21, 2023 01:17 PM

    Thanks for the reply Scott. I came across the restrictions after I posted this, so that was insightful. I was able to produce a message in the SYSLOG using EXEC CICS WRITE OPERATOR. 



    ------------------------------
    Christian Gonzalez
    ------------------------------



  • 4.  RE: CICS program to display in SYSOUT or CONSOLE

    Posted Mon August 21, 2023 01:20 PM

    Download Thumbs Up Emoji Smiley Royalty-Free Vector Graphic - Pixabay



    ------------------------------
    Scott Fagen
    Mainframe Evangelist
    CDW
    www.cdw.com/content/cdw/en/solutions/ibm-zsystems.html
    ------------------------------



  • 5.  RE: CICS program to display in SYSOUT or CONSOLE

    Posted Tue August 22, 2023 08:20 AM
    Christian,

    For development and testing, I use COBOL's DISPLAY which writes to CICS' CEEMSG log, not SYSOUT,.  It is sometimes helpful to also write a brief description of true errors.

    Use judiciously, as you can fill up the log pretty quickly.

    DISPLAY "The SELECT statement in "  paragraph_name " returned an SQLCODE = -511"

    Cheers,

    Jon Butler





  • 6.  RE: CICS program to display in SYSOUT or CONSOLE

    Posted Wed August 23, 2023 07:51 AM

    You can use the older "with debugging mode" feature or the new with COBOL 6 more flexible conditional compilation to preserve your testing DISPLAY statements in the source for the next round of changes. Here the compiler option DEFINE(DEBUG=1) will compile in the DISPLAY statement, omitting it will make the DISPLAY a comment.

     >>DEFINE DEBUG AS PARAMETER 
     >>IF DEBUG IS NOT DEFINED   
       >>DEFINE DEBUG AS 0       
     >>END-IF                    
    ...
     >>IF DEBUG > 0
        DISPLAY "Hello from a test message."
     >>END-IF

    Bernie

    Conditional Compilation



    ------------------------------
    Bernie Rataj
    Technical Support Professional
    IBM Canada Ltd.
    Markham ON Canada
    https://www.ibm.com/products/cobol-compiler-zos
    https://www.ibm.com/products/pli-compiler-zos
    ------------------------------