CEEMOUT—Dispatch a message

CEEMOUT dispatches a user-defined message string to the message file.
Read syntax diagramSkip visual syntax diagram
Syntax

>>-CEEMOUT--(--message_string--,--destination_code--,--fc--)---><

message_string (input)
A halfword-prefixed printable character string containing the message. DBCS characters must be enclosed within shift-out (byte X'0F') shift-in (X'0E') characters. Insert data cannot be placed in the message with CEEMOUT. The halfword-prefixed message string (input) must contain only printable characters. For length greater than zero, unpredictable results will occur if the byte following the halfword prefix is X'00"
destination_code (input)
A 4-byte binary integer. The only accepted value for destination_code is 2. Under systems other than CICS®, Language Environment writes the message to the ddname of the file specified in the MSGFILE runtime option. Under CICS, the message is written to a transient data queue named CESE.
fc (output)
A 12-byte feedback code, optional in some languages, that indicates the result of this service. If you choose to omit this parameter, refer to Invoking callable services for the appropriate syntax to indicate that the feedback code was omitted.

The following symbolic conditions can result from this service:

Code Severity Message number Message text
CEE000 0 The service completed successfully.
CEE0E3 3 0451 An invalid destination code destination-code was passed to routine routine-name.
CEE0E9 3 0457 The message file destination ddname could not be located.

Usage notes

  • z/OS UNIX considerations—In multithread applications, CEEMOUT affects only the calling thread. When multiple threads write to the message file, the output is interwoven by line. To group lines of output, serialize MSGFILE access (by using a mutex, for example).
  • If the message file is defined with an LRECL greater than 256, and the input to CEEMOUT is greater than 256 bytes, the output results in multiple records. The first 256 bytes of each record contains output data. The remaniing bytes of each record, up to the LRECL size, might contain unpredictable data.

For more information

Examples

  1. Following is an example of CEEMOUT called by C/C++.
    /*Module/File Name: EDCMOUT   */
    
    #include <string.h>
    #include <stdio.h>
    #include <stdlib.h>
    #include <leawi.h>
    #include <ceeedcct.h>
    
    int main(void) {
    
      _VSTRING message;
      _INT4 dest;
      _FEEDBACK fc;
    
      strcpy(message.string,"This is a test message");
      message.length = strlen(message.string);
      dest = 2;
    
      CEEMOUT(&message,&dest,&fc);
    
      if ( _FBCHECK ( fc , CEE000 ) != 0 ) {
         printf("CEEMOUT failed with message number %d\n",
                fc.tok_msgno);
         exit(2999);
      }
      /* .
         .
         . */
    }
  2. Following is an example of CEEMOUT called by COBOL.
    CBL LIB,QUOTE
          *Module/File Name: IGZTMOUT
          ************************************************
          ** CBLMOUT - Call CEEMOUT to dispatch a msg.  **
          ** In this example, a call is made to CEEMOUT **
          ** to dispatch a user-defined message string  **
          ** to the ddname specified defaulted in the   **
          ** MSGFILE runtime option.                   **
          ************************************************
           IDENTIFICATION DIVISION.
           PROGRAM-ID. CBLMOUT.
           DATA DIVISION.
           WORKING-STORAGE SECTION.
           01  MSGSTR.
               02  Vstring-length      PIC S9(4) BINARY.
               02  Vstring-text.
                   03  Vstring-char        PIC X,
                               OCCURS 0 TO 256 TIMES
                               DEPENDING ON Vstring-length
                                  of MSGSTR.
           01  DESTIN                  PIC S9(9) BINARY.
           01  FC.
               02  Condition-Token-Value.
               COPY  CEEIGZCT.
                   03  Case-1-Condition-ID.
                       04  Severity    PIC S9(4) BINARY.
                       04  Msg-No      PIC S9(4) BINARY.
                   03  Case-2-Condition-ID
                             REDEFINES Case-1-Condition-ID.
                       04  Class-Code  PIC S9(4) BINARY.
                       04  Cause-Code  PIC S9(4) BINARY.
                   03  Case-Sev-Ctl    PIC X.
                   03  Facility-ID     PIC XXX.
               02  I-S-Info            PIC S9(9) BINARY.
           PROCEDURE DIVISION.
           PARA-CBLMOUT.
          *************************************************
          ** Create message string and specify length    **
          *************************************************
               MOVE 25 TO Vstring-length of MSGSTR.
               MOVE "CEEMOUT ran successfully"
                    TO Vstring-text of MSGSTR.
          *************************************************
          ** Specify 2 to send the message to the ddname **
          **     specified or defaulted in the MSGFILE   **
          **     runtime option.                        **
          *************************************************
               MOVE 2 TO DESTIN.
               CALL "CEEMOUT" USING MSGSTR, DESTIN, FC.
               IF  NOT CEE000 of FC  THEN
                   DISPLAY "CEEMOUT failed with msg "
                       Msg-No of FC UPON CONSOLE
                   STOP RUN
               END-IF.
               GOBACK.
  3. Following is an example of CEEMOUT called by PL/I.
    *PROCESS MACRO;
     /* Module/File Name: IBMMOUT                        */
     /****************************************************/
     /** Function: CEEMOUT - Dispatch a message         **/
     /**                                                **/
     /** In this example, CEEMOUT is called to dispatch **/
     /** a user-defined message string to the ddname    **/
     /** specified or defaulted in the MSGFILE runtime **/
     /** option.                                        **/
     /****************************************************/
     PLIMOUT: PROC OPTIONS(MAIN);
    
        %INCLUDE  CEEIBMAW;
        %INCLUDE  CEEIBMCT;
    
        DCL MSGSTR CHAR(255) VARYING;
        DCL DESTIN REAL FIXED BINARY(31,0);
        DCL 01 FC,                     /* Feedback token */
               03 MsgSev    REAL FIXED BINARY(15,0),
               03 MsgNo     REAL FIXED BINARY(15,0),
               03 Flags,
                  05 Case      BIT(2),
                  05 Severity  BIT(3),
                  05 Control   BIT(3),
               03 FacID     CHAR(3),      /* Facility ID */
               03 ISI   /* Instance-Specific Information */
                            REAL FIXED BINARY(31,0);
    
        MSGSTR = 'CEEMOUT ran successfully.';
                               /* Set message string     */
        DESTIN = 2;            /* Send to MSGFILE ddname */
    
        /* Dispatch message to destination by a  */
        /*    call to CEEMOUT                    */
        CALL CEEMOUT ( MSGSTR, DESTIN, FC );
        IF  FBCHECK( FC, CEE000)  THEN  DO;
           PUT SKIP LIST( 'Message "' || MSGSTR
              || '" sent to destination ' || DESTIN );
           END;
        ELSE  DO;
           DISPLAY( 'CEEMOUT failed with msg '
              || FC.MsgNo );
           STOP;
           END;
    
     END PLIMOUT;