Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1083291
  • 博文数量: 106
  • 博客积分: 9093
  • 博客等级: 中将
  • 技术积分: 2770
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-01 17:22
文章分类

全部博文(106)

文章存档

2014年(1)

2012年(29)

2011年(32)

2010年(20)

2008年(24)

分类:

2008-07-17 13:58:49

1,ILE C调用ILE RPG
PGMC:
#include                     
#pragma linkage(PGMRPG,OS,nowiden)    
int main(int argc, char **argv)       
{                                     
 char *parm1;                         
 char *parm2;                         
 printf("nC program n");            
 parm1 = argv??(1??);                 
 parm2 = argv??(2??);                 
 printf(" nparm1 = %s n", parm1 );   
 printf(" nparm2 = %s n", parm2 );   
 PGMRPG(parm1,parm2);                 
 return;                              
}          
 
PGMRPG:
D parm1           S             10A                   
D parm2           S             10A                   
C     *ENTRY        PLIST                             
C                   PARM                    parm1     
C                   PARM                    parm2     
C     'RPG program' dsply                             
C     'parm1 ='     dsply                             
C     parm1         dsply                             
C     'parm2 ='     dsply                             
C     parm2         dsply                             
C                   eval      *inlr=*on                                           
 
2,ILE RPG调用ILE C
①ILE RPG调用函数方法:
H BNDDIR('QC2LE') DFTACTGRP(*NO)                             
D LOG10           PR             8F   EXTPROC('log10')       
D input                          8F   Value                  
D SP1             S              8P 0                        
D SP2             S              8P 0                        
C*                                                           
C                   Z-ADD     10            SP1              
C                   EVAL      SP2=LOG10(SP1)                 
C     SP1           dsply                                    
C     SP2           dsply                                    
C*                                                           
C                   eval      *inlr=*on                      
C                   RETURN                                   
②ILE RPG调用ILE C方法:
PGMRPG3:
H DEBUG                                                
D SP1             S              8P 2 INZ(0) EXPORT    
D SP2             S              8P 5 INZ(0) EXPORT    
C*                                                     
C                   Z-ADD     10            SP1        
C                   CALLB     'PGMC'                   
C     SP1           dsply                              
C     SP2           dsply                              
C*                                                     
C                   eval      *inlr=*on                
C                   RETURN                       
 
TEST01C:
#include            
#include             
#include          
                             
extern decimal(8,2) SP1;     
extern decimal(8,5) SP2;     
void PGMC()                  
{                            
  SP2 = log10(SP1);          
 }                           
 
CRTRPGMOD MODULE(ZYF/PGMRPG3) SRCFILE(ZYF/QRPGSRC)        
CRTCMOD MODULE(ZYF/TEST01C) SRCFILE(ZYF/QCLPSRC)
CRTPGM PGM(ZYF/PGMRPG3) MODULE(ZYF/PGMRPG3 ZYF/TEST01C) 
阅读(1975) | 评论(0) | 转发(1) |
给主人留下些什么吧!~~