Chinaunix首页 | 论坛 | 博客
  • 博客访问: 348216
  • 博文数量: 90
  • 博客积分: 847
  • 博客等级: 准尉
  • 技术积分: 1373
  • 用 户 组: 普通用户
  • 注册时间: 2012-08-02 10:54
个人简介

跌打滚爬中的小菜鸟...

文章分类

全部博文(90)

文章存档

2015年(5)

2013年(47)

2012年(38)

我的朋友

分类: 系统运维

2012-10-22 19:28:58

1. PF对应DDS

点击(此处)折叠或打开

  1. FMT A* .....A*. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
  2. *************** Beginning of data **********************************************
  3. 0001.00 *
  4. 0002.00 A UNIQUE
  5. 0003.00 A R RCUST
  6. 0004.00 A CUSNO 5A
  7. 0005.00 A CUSNM 30
  8. 0006.00 A CUSAD 30
  9. 0007.00 A CUSCT 30
  10. 0008.00 A CUSST 2
  11. 0009.00 A CUSCP 9
  12. 0010.00 A CUSPH 10 0
  13. 0011.00 A K CUSNO
  14. ****************** End of data *************************************************

2. RPG Source

  1. FMT * *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 ...+... 8
  2. *************** Beginning of data *****************************************
  3. 0001.00 *
  4. 0002.00 FCUSTOMER2 IF E K DISK
  5. 0003.00 *
  6. 0005.00 C MOVE '60003' CUSNO
  7. 0006.00 C CUSNO CHAIN RCUST 3738
  8. 0007.00 C *IN37 DSPLY
  9. 0008.00 C *IN38 DSPLY
  10. 0009.00 C CUSNM DSPLY
  11. 0011.00 C SETON LR
  12. 0012.00 C RETURN
  13. ****************** End of data ********************************************

如果对一个要进行CHAIN操作的外部没有声明Record Address Type(即默认为空),那你在用CHAIN查询时一般是不能得到想要的结果的.(如果查询的刚好是第一条呢??)


看下Reference对Record Address Type的说明:
Position 34 (Record Address Type)    
Entry Explanation 
Blank Relative record numbers are used to process the file. 
       Records are read consecutively. 
       Record address file contains relative-record numbers. 
       For limits processing, the record-address type (position 34) is the same as the type of the file being processed. 
A     Character keys (valid only for program-described files specified as indexed files or as a record-address-limits file). 
... ...
K     Key values are used to process the file. This entry is valid only for externally described files.
其他值也都是valid only for program-described file. 不讨论program-described file.

Relative Record Numbers也是就大名鼎鼎的RRN!
明白了吧,不说明Record Address Type的情况下默认文件是按RRN顺序读取的,此时用READ操作自然是不会有问题的,但是如果用CHAIN的话...MLGB,看资料时也没人提醒下,我CHAIN了一下午也没找到数据,可数据明明是有的啊!!!!

额外的猜想:
1. 不声明K,用CHAIN找第一天Record能找到不?
2012-10-22 19:44:12刚测试了下,还是读不到的...看来CHAIN操作的FILE必须声明K.

2. 声明K,但不使用CHAIN而用READ,可以吗?
2012-10-22 19:52:40测试了下,声明K后可以用READ操作,但是这次读取的顺序不是按RRN顺序读的.
1. 下图是声明为K,用READ读取的结果
2. 下图是没声明K,直接用READ读取的
3. 下图是PF中的RRN顺序


PS:自学真的苦逼啊.
阅读(1047) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~