Chinaunix首页 | 论坛 | 博客
  • 博客访问: 99522
  • 博文数量: 64
  • 博客积分: 60
  • 博客等级: 民兵
  • 技术积分: 335
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-26 17:23
文章分类
文章存档

2012年(64)

我的朋友

分类:

2012-04-11 17:12:16

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) 
阅读(493) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~