Chinaunix首页 | 论坛 | 博客
  • 博客访问: 60824
  • 博文数量: 11
  • 博客积分: 1455
  • 博客等级: 上尉
  • 技术积分: 225
  • 用 户 组: 普通用户
  • 注册时间: 2008-01-10 12:28
文章分类

全部博文(11)

文章存档

2018年(1)

2012年(1)

2011年(5)

2009年(1)

2008年(3)

我的朋友
最近访客

分类:

2012-02-13 14:36:42

练习一

 

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)

阅读(509) | 评论(0) | 转发(0) |
0

上一篇:WINDOW

下一篇:DDS

给主人留下些什么吧!~~