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

2012年(64)

我的朋友

分类:

2012-04-11 13:47:47

原文地址:RPGLE中简单的指针用法 作者:pantierui

例1:
D p1              S               *                             
D p2              S               *                             
D Result          S              1A   INZ                       
D Diff            S              5S 0 INZ                       
C                   alloc     20            p1                  
C                   EVAL      %STR(P1:20) ='abcdefghij'         
C                   EVAL      Result = %STR(P1:1)               
C                   DSPLY                   Result              
C                   EVAL      P2 = P1 + 8                       
C                   EVAL      Result = %STR(P2:1)               
C                   DSPLY                   Result              
C                   EVAL      P2 = P2 - 1                       
C                   EVAL      Result = %STR(P2:1)               
C                   DSPLY                   Result              
C                   EVAL      Diff = P2 - P1                    
C                   DSPLY                   Diff                
C                   DEALLOC                 P1                         
C*                                                                     
C                   SETON                                            LR
C                   RETURN                                             
 
例2:
H DATFMT(*ISO)                                                 
D Date            S               D   INZ(D'2010-03-29')       
D DatDS           DS                  BASED(PTR)               
D  YYYY                          4  0                          
D  Y_sep                         1                             
D  MM                            2  0                          
D  D_sep                         1                             
D  DD                            2  0    
D*                      
D PTR             S             16*                            
D vYear           S              4  0                          
D vMM             S              2  0                          
D vDD             S              2  0                          
C                   EVAL      PTR = %ADDR(Date)                
C                   EVAL      vYear  = YYYY                    
C                   EVAL      vMM = MM                         
C                   EVAL      vDD = DD                         
C                   DSPLY                   vYear                     
C                   DSPLY                   vMM                       
C                   DSPLY                   vDD                       
C*                                                                    
C                   SETON                                            LR
C                   RETURN                                            
 
阅读(764) | 评论(0) | 转发(0) |
0

上一篇:没有了

下一篇:简单的procedure程序

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