Chinaunix首页 | 论坛 | 博客
  • 博客访问: 48253
  • 博文数量: 10
  • 博客积分: 557
  • 博客等级: 下士
  • 技术积分: 250
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-25 20:13
文章分类

全部博文(10)

文章存档

2011年(9)

2010年(1)

分类:

2011-07-20 10:14:16

1.调用对象

       Extprocmain proceduresubprocedure

       ExtpgmOPMILE *pgm

 

2.调用性质:

       Extproc:静态调用

       Extpgm:动态调用

 

3.传参方式:

       Extprocby referenceby read-only referenceby value

       Extpgmby referenceby read-only reference

 

4.示例:

Extpro Demo:

 

pass1.rpgle

HNOMAIN                                           

 /INCLUDE QCPYSRC,PASSBY                   

P BYVALUE         B                   EXPORT     

D BYVALUE         PI            40A              

D  PARM1                            2P 0            

D  PARM2                            20A   VALUE      

C                   IF        PARM1 = 1          

C                   RETURN    PARM2+'LIKE RPG III'

C                   ELSE                         

C                   EVAL      PARM2 = 'LIKE RPG' 

C                   RETURN    PARM2+'LIKE RPG IV'

C                   ENDIF                        

P                 E                              

 

pass2.rpgle

D AAA             PR            40A   EXTPROC('BYVALUE') 

D  A1                            2P 0                    

D  A2                           20A   VALUE            

D NUM             S              2P 0                    

D STRING          S             20A   INZ('KKK')         

D RESULT1         S             30A                      

C                   EVAL      NUM = 1                 

C                   EVAL      RESULT1 = AAA(NUM:STRING)

C     RESULT1       DSPLY                             

C                   EVAL      *INLR = *ON   

C                   RETURN                         

 

 

Extpgm Demo

 

DDS CODE:

A..........T.Name++++++RLen++TDpB......Functions+

A          R ABCR                               

A            F1            10A                  

 

 

RPG CODE

FFilenameIPEAF........L..I........Device+......KExit++Entr

FABC     O   E                    DISK                    

C           *ENTRY    PLIST                              

C                     PARM           MLNAME 10           

C                     MOVELMLNAME    F1                  

C                     WRITEABCR                          

C                     SETON                     LR       

C                     RETRN                              

 

 

RPGLE CODE

DTESTADD          PR                  EXTPGM('ADD')           

D                               10A                           

D PASSSTYLE       PR                                          

D  P2                           10A                                             

D PASSSTYLE       PI                                          

D P2                            10A                           

D P1              S             10A                                            

C                                                              

C                   CALLP     TESTADD(P2)                     

C                   EVAL      *INLR = *ON                     

C                   RETURN                                    

 

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