免费注册 查看新帖 |

Chinaunix

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

调用程序的错误信息,请大侠们帮忙解决 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-07-24 11:06 |只看该作者 |倒序浏览
本帖最后由 seouldeng 于 2012-07-24 11:08 编辑

引用  PASSTRU的博客文章  
目的:

本例子演示RPGLE使用服务程序(*SRVPGM)通过指针传递参数进行调用。调用程序可以通过bnddir对服务程序进行直接调用,无需服务程序与子系统直接关联。



服务程序:TSRV.*SRVPGM

服务程序下挂服务应用程序M1.*Module

BNDDIR:BTEST

测试程序:TEST.*PGM



M1.RPGLE:(用15编译成M1.*Module,放在MyLib目录下。)

d M1              Pr                              

d  Ptr1                           *               

d  Ptr2                           *               

*                                                

d C_Str              s             20               

d C_String        s             20    based(Ptr1)

d Ptr1            s               *               

d Ptr2            s               *               

*                                                

c     *entry        plist                        

c                   parm                    Ptr1  

c                   parm                    Ptr2  

/free                                            

     C_Str = C_String ;                           

     C_Str = 'Hello! ' + C_Str ;                  

     Ptr2 = %addr(C_Str) ;                        

                                                  

*inlr = *on ;            

return ;

/end-free



服务程序TSRV.rpgle:(用15编译成TSRV.*Module,放在MyLib目录下)

/free

Return ;

/end-free



服务程序TSRV下的服务应用程序定义bnd.rpgle文件:(放在MYLIB/BNDSRC目录下,无需编译)

STRPGMEXP SIGNATURE('TSRV')

   EXPORT SYMBOL('M1')     

ENDPGMEXP                  



创建服务程序TSRV.*srvpgm:(编译结果放在MyLib目录下)

CRTSRVPGM SRVPGM(MYLIB/TSRV)           

          MODULE(MYLIB/TSRV  MYLIB/M1)

          SRCFILE(MYLIB/BNDSRC)      



创建BTEST. *BNDDIR(放在MyLib目录下):

CRTBNDDIR BNDDIR(MYLIB/BTEST)



加载服务程序TSRV.*srvpgm到BTEST bnddir下:

ADDBNDDIRE BNDDIR(MYLIB/BTEST) +   

             OBJ((MYLIB/TSRV))



或者用WRKBNDDIR对BTEST.*bnddir进行交互操作。



测试程序TEST.rpgle:(用14进行编译,放在MYLIB下)

H BNDDIR('BTEST')                                 

H DFTACTGRP(*NO)                                 

H OPTION(*ShowCpy)                                

*                                                

d M1              Pr                       ExtPgm('M1')                                 

d  Ptr1                           *               

d  Ptr2                           *               

*                                                

d C_Str              s             20    inz('Body')

d C_String        s             20    based(Ptr2)

d Ptr1            s               *               

d Ptr2            s               *               

*                                                

/free                                            

     Ptr1 = %addr(C_Str) ;                        

     callp M1(Ptr1tr2) ;                        

                                                  

    *inlr = *on ;                                 

return ;                                      



/end-free

最后一步调用程序TEST,报错
Message . . . . :   Error occurred while calling program or procedure *LIBL/M
  (C G D F).                                                                 
Cause . . . . . :   RPG procedure TEST in program POPGLIB/TEST at statement 1
  attempted to call program or procedure *LIBL/M1, but was unable to access  
  the program or procedure, the library, or a required service program. If th
  name is *N, the call was a bound call by procedure pointer.               
Recovery  . . . :   Check the job log for more information on the cause of th
  error and contact the person responsible for program maintenance.         
Possible choices for replying to message . . . . . . . . . . . . . . . :     
  D -- Obtain RPG formatted dump.                                            
  S -- Obtain system dump.                                                   
  G -- Continue processing at *GETIN.                                       

单步进去,CALLP那里报错
Message . . . . :   Cannot resolve to object M1. Type and Subtype X'0201'   
  Authority X'0000'.                                                        
Cause . . . . . :   Either a system pointer or a data pointer can not be   
  resolved.                                                                 
    For a system pointer, it can not be resolved to object M1, type and     
  subtype X'0201', authorization X'0000', because either the named object wa
  not in any context referred to or the correct object was located but the  
  user profile did not have the required authority.                        
    The object types for common type or subtype codes follow:               
    -- 0100-Access group, 0201-Program, 0401-Library,                       
    -- 0701-Journal receiver, 0801-User profile, 0901-Journal,              
    -- 0B90-Data space, 0C90-Data space index, 0D50-Data base file member,  

不知道我是什么原因导致出错的呢?

论坛徽章:
0
2 [报告]
发表于 2012-07-24 13:22 |只看该作者
把调用程序的关键字ExtPgm('M1')  更改为EXTPROC('M1')  ,程序就运行正常了。不过个人还不是很理解为什么要改为EXTPROC,虽然EXTPROC是调用服务程序的M1模块,M1是*MODULE类型。但是通过SRVPGM连接起来的M1不能够用EXTPGM调用?不知道有没有大侠知道?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP