免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 11766 | 回复: 7
打印 上一主题 下一主题

CL 中的MONMSG [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-09-18 12:15 |只看该作者 |倒序浏览
请问RPG中,有这样的语句:
MONMSG MSGID(CPF0000)
MONMSG MSGID(CPF1234)
等是什么意思呢?

论坛徽章:
0
2 [报告]
发表于 2013-09-18 14:42 |只看该作者
The Monitor Message (MONMSG) command is used to monitor escape,     
notify, and status messages sent to the program message queue of the
program in which the command is used.  Completion and diagnostic   
messages cannot be monitored.                                       
                                                                    
When the MONMSG command is compiled in a control language (CL)      
program, it establishes a monitor for the arrival of the specified  
messages.  The command monitors the messages for the condition      
specified by the comparison data given in the command.  If a message
meeting the conditions arrives on the message queue, the CL command
specified on the MONMSG command is processed.                       
                                                                    
Up to 1000 MONMSG commands can be specified in a program to monitor
the arrival of messages for specific conditions or for a group of   
conditions.  Specific message identifiers or generic message        
identifiers can be monitored.                                       
                                                                    
The MONMSG command can be coded following most commands in a CL     
program or ILE CL procedure.  A MONMSG command that is not placed at
the beginning of the program applies only to the immediately        
preceding command; this is called a command-level MONMSG command.   
The command-level MONMSG command monitors only messages sent by the
previous command.  If the message sent by that command meets the   
conditions specified in the MONMSG command, the action specified in
the same MONMSG command is taken.  As many as 100 MONMSG commands,  
coded immediately after a command, can monitor the messages sent by
that command.                                                      
                                                                    
When the action specified in the MONMSG command has been performed,
and that action does not end with a GOTO or RETURN command, control
returns to the command in the program that follows the command that
sent the message.  If the action ends with a GOTO command, control  
branches to the command in the program specified in the GOTO        
command.  If the action ends with a RETURN command, control returns
to the program that called the program that contains the MONMSG     
command.                                                            
                                                                    
If one or more MONMSG commands are placed at the beginning of the   
program, immediately following the declare commands or the PGM      
command if there are no declare commands, they monitor messages sent
by all of the commands in the program (maximum of 100).  This is   
called a program-level MONMSG command.  If any message sent by any  
command in the program meets the conditions specified in any one of
the program-level MONMSG commands, the corresponding action         
specified in the same command is taken.                             
The action taken by a command-level MONMSG command overrides a      
program-level MONMSG command.                                       
                                                                    
If a command is coded for the EXEC parameter on a MONMSG command   
that is placed at the beginning of a program, only the GOTO command
can be used, and it must specify the label for the command to which
control is to be passed if a monitored message occurs.  The label   
specified on a program-level MONMSG command cannot be a label      
associated with a subroutine.  If a GOTO command is performed for a
program-level MONMSG, the subroutine stack will be reset by the next
Call Subroutine (CALLSUBR) command.                                 
                                                                    
If a command is not coded for the EXEC parameter, monitored messages
are ignored.                                                        
Restrictions:                                                      
o  This command is valid only in a CL program or ILE CL procedure.
o  It can be coded after the last declare command (if declare      
    commands are used), following the PGM command that begins the   
    program, or it can be coded following any command allowed in a  
    CL program or ILE CL procedure, except for the following:  DO,  
    DOWHILE, DOUNTIL, DOFOR, ELSE, ENDDO, SELECT, WHEN, OTHERWISE,  
    ENDSELECT, ENDPGM, CALLSUBR, SUBR, RTNSUBR, ENDSUBR, GOTO, IF,  
    or RETURN.  Note that if another program sends a message that is
    monitored by this command, a return cannot be made to that      
    program.                                                        
                                                                    
Examples for MONMSG                                                      
                                                                          
    Example 1: Monitoring Messages Sent by Any Command                    
                                                                          
        PGM                                                               
        MONMSG   MSGID(CPF0001  CPF1999)  EXEC(GOTO  EXIT2)               
                                                                          
    This example shows a MONMSG command at the beginning of a CL         
    procedure that monitors for messages CPF0001 and CPF1999; these      
    messages might be sent by any command processed later in the         
    procedure. When either message is received from any of the commands   
    running in the procedure, control branches to the command identified  
    by the label EXIT2.                                                   
                                                                          
    CPF0001 states that an error was found in the command that is         
identified in the message itself. CPF1999, which can be sent by many
of the debugging commands (like CHGPGMVAR), states that errors      
occurred on the command, but it does not identify the command in the
message.                                                            
                                                                     
Example 2: Monitoring Messages Sent by a Single Command              
                                                                     
    CHGVAR   VAR(&A)  VALUE(&A / &B)                                 
    MONMSG   MSGID(MCH1211)  EXEC(CHGVAR  VAR(&A)  VALUE(1))         
                                                                     
In this example, the MONMSG command follows a Change Variable        
(CHGVAR) command and, therefore, is only monitoring messages sent by
the CHGVAR command. Escape message MCH1211 is sent to this program's
message queue when a division by zero is attempted.  Because         
MSGID(MCH1211) is specified, the MONMSG command is monitoring for   
this condition; when it receives the message, the second CHGVAR   
command is processed. In this command, the variable &A is set to a
value of 1.                                                        

论坛徽章:
0
3 [报告]
发表于 2013-09-18 15:32 |只看该作者
回复 2# shibuya_cu


谢谢回复,这个描述文档可以在哪里找到的?
   

论坛徽章:
0
4 [报告]
发表于 2013-09-18 18:32 |只看该作者
Enter MONMSG
F4 -》 F1

论坛徽章:
0
5 [报告]
发表于 2013-09-18 21:05 |只看该作者
shibuya_cu 发表于 2013-09-18 14:42
The Monitor Message (MONMSG) command is used to monitor escape,     
notify, and status messages se ...


CPF0001  CPF1999 这些值的定义和含义可以在哪来查到,可以自己定义吗?

论坛徽章:
0
6 [报告]
发表于 2013-09-20 14:36 |只看该作者
WRKMSGD CPFxxxx, 可以自定义MSGID

回复 5# softiger


   

论坛徽章:
0
7 [报告]
发表于 2013-09-21 16:25 |只看该作者
shibuya_cu 发表于 2013-09-20 14:36
WRKMSGD CPFxxxx, 可以自定义MSGID

回复 5# softiger


通过WRKMSGD 定义了MSGID后,自己开发的RPG,CL,C 等程序,可以发出这个这指定MSGID的错误吗?

论坛徽章:
0
8 [报告]
发表于 2013-09-22 21:36 |只看该作者
请参考我写的《 OS400下,CLP或RPGLE中的出错处理机制》,
http://blog.chinaunix.net/uid-20328593-id-3530258.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP