Chinaunix首页 | 论坛 | 博客
  • 博客访问: 55979
  • 博文数量: 18
  • 博客积分: 161
  • 博客等级: 入伍新兵
  • 技术积分: 135
  • 用 户 组: 普通用户
  • 注册时间: 2012-03-14 21:52
文章分类
文章存档

2012年(18)

分类:

2012-04-15 21:17:38

 关键字:RPGLE|PROCEDURE|SRVPGM

 

服务程序:PROC12.rpgle代码

crtrpgmod,或选项15,生成PROC12.module

 

* Procedure 内部调用                               

 * Proc2(nomain) 被调用                              

 * 默认值: nomain                                  

 *                                                  

H nomain                                            

 *                                                   

d Proc12          pr             7                  

d  MyCallRet                    20                  

 *                                                  

pProc12           b                   export        

d Proc12          pi             7                  

d  MyCallRet                    20                  

 *                                                  

d MyParm2         s             20    inz('RPGLE')  

d Rc              s              7    inz('0000000')

d Erc             s              7    inz('1111111')

 *                                                 

 /free                                             

    monitor ;                                       

       MyCallRet = 'Hello, RPGLE' ;                

    on-error ;                                     

       Rc = Erc ;                                  

    endmon ;                                       

     //*inlr = *on ;                               

     return Rc ;                                   

 /end-free                                         

pProc12           e                                

 

PROCSRV.BND代码:

STRPGMEXP SIGNATURE('PROCSRV')

   EXPORT SYMBOL('PROCSRV')  

   EXPORT SYMBOL('PROC12')   

ENDPGMEXP                    

 

Service PROCSRV.module代码:

 /free

     Return ;

 /end-free

 

生成PROCSRV.*SRVPGM命令:

CRTSRVPGM SRVPGM(MYLIB/PROCSRV)            
          MODULE(MYLIB/PROCSRV MYLIB/PROC12)
          SRCFILE(MYLIB/QRPGLESRC2)  
      

 

应用程序PROC2.rpgle代码:

* Procedure 内部调用                              

 * Proc2(main) 调用 Proc12(nomain)                

 * 默认值: main                                  

 *                                                

H*Main Proc2                                      

H BNDDIR('MYBND')                                 

 *                                                

d/copy QRPGLESRC2,RPGTXTSRC2                      

 *                                                

d MyParm2         s             20    inz('Hello')

d Rc              s              7    inz          

 *                                                

 /free                                            

     Rc = Proc11(MyParm2) ;                       

                                                  

     *inlr = *on ;                                 

     return ;                              

 /end-free                                 

 *                                         

pProc11           b                   export

d Proc11          pi             7         

d  MyParm2                      20         

 *                                         

 /free                                     

     //MyParm2 为Hello                

     dsply MyParm2 ;                       

     // 调用 SubProcedure,Proc2            

     Rc = Proc12(MyParm2) ;                

     //MyParm2 为RPGLE                

     dsply MyParm2 ;                       

     return  Rc ;                          

/end-free        

pProc11           e

 

crtrpgmod,或选项15,生成PROC2.module

 

CRTPGM,生成PROC2.PGM

CRTPGM PGM(/PROC2) MODULE(/PROC2)

 

创建BNDDIR:

CRTBNDDIR BNDDIR(MYBND)

 

加载服务程序到BNDDIR:

ADDBNDDIRE BNDDIR(MYLIB/MYBND)
           OBJ((MYLIB/PROCSRV))

 

 Service program  . . . . . . . . > PROCSRV       Name                         
   Library  . . . . . . . . . . . >   MYLIB       Name, *CURLIB                
 Module . . . . . . . . . . . . . > PROCSRV       Name, generic*, *SRVPGM, *ALL
   Library  . . . . . . . . . . . >   MYLIB       Name, *LIBL, *CURLIB...      
                + for more values > PROC12                                     
                                  >   MYLIB                                    
 Export . . . . . . . . . . . . .   *SRCFILE      *SRCFILE, *ALL               
 Export source file . . . . . . . > QRPGLESRC2    Name, QSRVSRC                
   Library  . . . . . . . . . . . >   MYLIB       Name, *LIBL, *CURLIB         
 Export source member . . . . . .   *SRVPGM       Name, *SRVPGM                
 Text 'description' . . . . . . .   *BLANK               

如果采用Export *SRCFILE默认参数,bnd文件PROCSRV.bnd是放在pf-src目录QRPGLESRC2下。

 

copybook:rpgtxtsrc2

d Proc11      pr          7
d  MyCallRet             20
 *

d Proc12      pr          7          extproc('PROC12')
d  MyCallRet                    20 

阅读(660) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~