Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8615499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:23:34+00:00 2026-06-12T05:23:34+00:00

I am writing a CL program which is going to encounter a lot of

  • 0

I am writing a CL program which is going to encounter a lot of errors, due to the fact that it will be executed in environments with all sorts of problems like missing objects (yes, that is deliberate). Instead of monitoring these possible messages and bypass the errors, I actually would like to redirect these messages so that they can be used the program messages and displayed to the user. So what I want is that after the program execution, the program puts all the error messages onto display on the bottom of the screen rather than having them pop up and disrupt the execution. Is it possible to do so? How?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:23:35+00:00Added an answer on June 12, 2026 at 5:23 am

    This is my standard CL error handling process. Generally, I would use MONMSG inline to handle errors I expect might be coming. Also generally, for errors I expect, I do not normally tell the end user about them. If you need to do that, make the RCVMSG/SNDPGMMSG pairs into a subroutine and call that inline to percolate the errors to the caller. The idea is to receive the diagnostic messages and re-send them to the caller, then do the same with the exception message.

        PGM
    
        DCL &MSGID  *CHAR 7    
        DCL &MSGDTA *CHAR 256 
    
        /* Trap all errors, and let the error routine handle */
        MONMSG (CPF0000 MCH0000) EXEC(GOTO ERROR)      
    
        /* processing happens here */
        /* if an unexpected error occurs, we drop to the error routine */
    
    /* We expect this error, but tell the caller about it anyway */
    dltf mylib/myfile
    monmsg cpf2105 exec(do)
    callsubr percolate
    endoo
    
        /* end of processing */
        RETURN                                                    
    
                /* This is the error handling routine.  Basically it */       
                /* simply re-sends the messages back up to the       */       
                /* caller, so it dies "gracefully" instead of        */       
                /* giving a hard halt.                               */       
                               /* Re-send diagnostic messages */              
        ERROR:      RCVMSG     MSGTYPE(*DIAG) MSGDTA(&MSGDTA) MSGID(&MSGID)   
                    IF         (&MSGID *EQ '       ') GOTO ERROR_ESC          
                    SNDPGMMSG  MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +  
                                 MSGTYPE(*DIAG)                               
                    MONMSG     (CPF0000 MCH0000)                              
                    GOTO       ERROR                                          
    
                               /* Re-send escape message and RETURN */        
        ERROR_ESC:  RCVMSG     MSGTYPE(*EXCP) MSGDTA(&MSGDTA) MSGID(&MSGID)   
                    SNDPGMMSG  MSGID(&MSGID) MSGF(QCPFMSG) MSGDTA(&MSGDTA) +  
                                 MSGTYPE(*ESCAPE)                             
                    MONMSG     (CPF0000 MCH0000)                              
                    RETURN                                                    
    
                    ENDPGM                                                    
    

    EDIT: Add subfile message queue to answer.

    Perhaps a subfile message queue?
    DDS:

     A          R BMENUS                    SFL
     A*
     A                                      TEXT('Message subfile')
     A                                      SFLMSGRCD(20)
     A            WMSGK                     SFLMSGKEY
     A            WPGMQ                     SFLPGMQ
     A          R BMENUC                    SFLCTL(BMENUS)
     A*
     A                                      TEXT('Message subfile control recor-
     A                                      d')
     A                                      OVERLAY
     A                                      LOCK
     A                                      SFLDSP
     A                                      SFLINZ
     A                                      SFLSIZ(0006)
     A                                      SFLPAG(0003)
     A            WPGMQ                     SFLPGMQ
    

    CLP:

             DCLF       FILE(BMENUFM)
             ...
             CHGVAR     &WPGMQ 'BMENU'
             ...
             SNDF       RCDFMT(BMENUC)
             SNDRCVF    RCDFMT(BMENUR)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a program which will use scan conversion on triangles to fill in
I'm writing a program which will allow to load a specific managed .DLL file
Writing a simple program that will find exact duplicate files on my computer, but
I'm writing an application in Python that is going to have a lot of
I am writing a program that will eventually be used to have one child
I am writing a program which will tokenize the input text depending upon some
I'm writing a program that needs to search a directory and all its sub
I am writing a program in C, which sorts words in a file appropriately
I'm going to be writing a program which has some web services in it
I'm writing a server program in Java that will allow users to submit jobs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.