Chinaunix首页 | 论坛 | 博客
  • 博客访问: 25035
  • 博文数量: 7
  • 博客积分: 10
  • 博客等级: 民兵
  • 技术积分: 25
  • 用 户 组: 普通用户
  • 注册时间: 2012-02-17 14:30
文章分类

全部博文(7)

文章存档

2013年(7)

我的朋友

分类: 系统运维

2013-06-16 12:20:36

练习一

 

Module:Proc(程序代码)

 

  * Procedure 内部调用                            

  * Proc1(main) 调用 Proc2(nomain)                

  * 默认值: main                                 

  *                                               

 H*Main Proc1                                     

  *                                               

 d/copy QRPGLESRC2,RPGTXTSRC                      

  *                                                

 d MyParm2         s             20    inz('Hello')

 d Rc              s              7    inz        

  *                                               

  /free                                           

      Rc = Proc1(MyParm2) ;                        

                                                  

      *inlr = *on ;                               

      return ;                                    

  /end-free                                  

  *                                          

 pProc1            b                   export

 d Proc1           pi             7          

 d  MyParm2                      20          

  *                                          

  *                                          

  /free                                       

      //MyParm2 为Hello                 

      dsply MyParm2 ;                        

      // 调用 SubProcedure,Proc2             

      Rc = Proc2(MyParm2) ;                  

      //返回值MyParm2 为Hello,RPGLE                 

      dsply MyParm2 ;                        

      return  Rc ;                           

  /end-free                                  

pProc1            e                               

 

Module:Proc1(程序代码)

                                                

 H nomain                                           

 d/copy QRPGLESRC2,RPGTXTSRC                        

  *                                                 

 pProc2            b                   export       

 d Proc2           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 ;                     

        //MyParm2 为Hello     

        dsply MyParm2 ;             

        MyCallRet = 'Hello, RPGLE' ;

        dsply MyCallRet ;          

     on-error ;                    

        Rc = Erc ;                 

     endmon ;                      

                                   

      return Rc ;                   

  /end-free                        

 pProc2            e               

 

copybookRPGTXTSRC .TXT代码:

  d Proc1           pr             7

  d  MyCallRet                    20

   *                                

  d Proc2           pr             7

  d  MyCallRet                    20

 

程序*PGM生成步骤:

1) crtrpgmod,或编辑选项15,编译Proc.rpgle,生成Proc.module

2) crtrpgmod,或编辑选项15,编译Proc1.rpgle,生成Proc1.module;

3) CtrPgm,创建Proc.pgm

             CRTPGM PGM(PINGY/PROC) MODULE(PINGY/PROC PINGY/PROC2)

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