【RPG TNT】在固定格式下使用free格式的注释

1874阅读 0评论2012-08-06 pantierui
分类:系统运维

我们在使用RPGLE编程的时候,有两种格式供我们选择:固定格式(Fixed-format)和自由格式(free-format)。

我们知道固定格式的注释和自由格式的注释是不同的。
固定格式
D Wait            S              1A                         
C* A comment, this is so you can read your program later.   
C* Anything after the * is ignored by RPGLE fixed format    
C                   Eval      String = 'Hello World!'       
C     String        Dsply                 
。。。             
              
     
自由格式
D Wait            S              1A                          
 /free                                                       
   // A comment, this is so you can read your program later. 
   // Anything after the * is ignored by RPGLE fixed format  
   String = 'Hello World!';                                  
   dsply String;            // this a comment
   。。。。
 /end-free

其实我们可以在固定格式中使用自由格式的注释
D Wait            S              1A               
 //display a string on terminal                   
C     'Hello World' Dsply                   Wait  
大家也许都以为自由格式的注释应该在/free和/enf-free之间,其实不然。
大家可以试一试。
上一篇:【LAPTHW】练习 10:分支和循环
下一篇:DDS数据类型的存储方式