MainframeSupports
tip week 10/2008:

The easiest way to output something from COBOL is no doubt by using the DISPLAY statement. No declaration of files or any other tricky stuff, just a simple DISPLAY 'Hello world' and immediately you have written something on the SYSOUT DD name. DISPLAY also formats all types of numeric and computational fields into readable stuff, but not always pretty. Well, who cares as long as it is written out.

If a DISPLAY statement gets executed in CICS it also works. The question is where it is written out because CICS normally does not have a SYSOUT DD name allocated. DISPLAY in COBOL running under CICS control is translated into a WRITEQ TD when running with Language Environment. The WRITEQ TD normally has a predefined destination of CESE. Using CICS transaction CEMT I TD DEST(CESE) you are able to see the DD name DISPLAY is sent to. It is most likely to be CEEMSG. Now all you have to do in order to find the result of DISPLAY is to locate the correct CICS region in SDSF or SYSVIEW and find DD name CEEMSG or whatever DD name used at your installation and search for your output there.

It would be nice to make DISPLAY to other DD names/destinations than SYSOUT/CEEMSG. In CICS there is no other option than to use WRITEQ TD to another destination which will require that you perform all the formatting yourself and that is not always what we were hoping for. In batch (and TSO) there are some other options. You can use a DISPLAY 'Hello world' UPON SYSPUNCH which makes the output go to DD name SYSPUNCH. A small side effect is that column 73-80 is filled out with the program name from PROGRAM-ID. If you can live with this then UPON SYSPUNCH is a fine alternative.

It is also possible to use UPON SYSLIST and UPON SYSLST but the output is sent to DD name SYSOUT anyway. UPON SYSPCH is also valid but the output ends on SYSPUNCH with the same side effect as when using UPON SYSPUNCH. The last possibility with DISPLAY is DISPLAY 'Hello world' UPON CONSOLE which works exactly like DISPLAY in PL/I. The output is sent to the system log. UPON CONSOLE will most likely not work in CICS, but I have not tried.

Previous tip in english        Sidste danske tip        Tip list