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

全部博文(106)

文章存档

2014年(1)

2012年(29)

2011年(32)

2010年(20)

2008年(24)

分类: 系统运维

2012-05-03 17:10:02

程序里的注释是很重要的。它们可以用自然语言告诉你某段代码的功能是什么。在你想要临时移除一段代码时,你还可以用注解的方式将这段代码临时禁用。接下来的练习将让你学会注释:

EX2

01 D String          S             51A                                                      
02 D Wait            S              1A                                                      
03 C* A comment, this is so you can read your program later.                                
04 C* Anything after the * is ignored by RPGLE fixed format                                 
05 C                   Eval      String = 'Hello World!'                                    
06 C     String        Dsply                                                  this a comment
07 C*                                                                                       
08 C* You can also use a comment to "disable" or comment out a piece of code:               
09 C*                  Eval      String = 'This won''t run'                                 
10 C                   Eval      String = 'This will run'                                   
11 C     String        Dsply                   Wait                                         
12 C*                                                                                       
13 C                   Eval      *inlr = *on                                                
14 C                   Return

EX2F

01 D String          S             51A                                           
02 D Wait            S              1A                                           
03  /free                                                                        
04    // A comment, this is so you can read your program later.                  
05    // Anything after the * is ignored by RPGLE fixed format                   
06    String = 'Hello World!';                                                   
07    dsply String;    // this a comment                                         
08    // You can also use a comment to "disable" or comment out a piece of code: 
09    //String = 'This won''t run';                                              
10    String = 'This will run';                                                  
11    dsply String '' wait;                                                      
12                                                                               
13    *inlr = *on;                                                               
14    return;                                                                    
15                                                                               
16  /end-free   


程序的编译和运行参考练习1的介绍。

1.       弄清楚“*”或“//”的作用。

2.       打开你的文件,从后往前逐行检查。从最后一行开始,倒着逐个单词单词检查回去。

3.       有没有发现什么错误呢?有的话就改正过来。

4.       朗读你写的习题,把每个字符都读出来。有没有发现更多的错误呢?有的话也一样改正过来。

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