- 论坛徽章:
- 0
|
Authoravid Mount
########## 请保留下面信息 ####################
作者:Authoravid Mount
出处:http://www.texas400.com/BSlogfil.html
翻译:Eric Kong mail:eric_cc@qq.ccom
关键字: 葡萄牙语 Mainframe AS400 Java 广州 求职 招聘 猎头 www.puyufanyi.com
备注:本人Java高级工程师,初学AS400,有好的职位,可以跟我联系,文章如果翻译不正确,敬请提出
################################################
Create 2 different Logical Files over a physical file
在一个物理文件的基础上创建两个逻辑文件
In only a few lines of source code, you can create a logical file. This is a way of reading the file with a different key. A logical file is a list of key values that point to the physical file. It does NOT contain copies of the data in the physical file.
只用几行代码, 就可以创建一个逻辑文件了,这是一种有用不同key去读取物理文件的方法,一个逻辑文件就是一个Key的列表,这些列表指向这个逻辑文件,但是逻辑文件不会包含物理文件的数据.
To create a logical file, enter your source statements in a DDS source file member named something like "CUS01". Make sure the member type is "LF". Enter the source code in Figure 1.
通过在DSS文件中输入代码创建逻辑文件,例如下面的"CUS01",确保Member的类型是"LF",输入下面图1的代码
The first line tells the compiler that this logical file will re-sequence the records in the physical file named in the "FILE" specification. In this case it is the "CUST" file. Also, notice that here we are using the same record name as the physical file, "CUREC". The only remaining lines are like the last two lines of the physical file source. Then name the fields that you want to use as keys.
第一行告诉了编译器这个逻辑文件会重排物理文件,"FILE"的标识符号表明重排的物理文件CUS,这里要注意的是,同样使用跟物理文件一样的记录名字CUREC,跟物理文件的DDS
相比,只有最下面的两行,定义了用city和state来做key,
Compile the file by using option 14. This time, the AS/400 will execute the "CRTLF" (create logical file) command. You now can read the customer file in city / state sequence simply be reading the file "CUS01" in keyed sequence.
用PDM界面的14来编译这个文件,这次AS/400执行的是"CRTLF" (create logical file)命令,你现在就可以用CUS01来,通city和state来顺序读取customer文件,
Now, create a logical file to select only certain records. The "S" type record will select only records that have customer status equal to "A", see Figure 2. Also, this logical file will read the records in customer name sequence.
现在,通过建立物理文件来选择选择某些特定的数据, "S"只会选择那些 customer status等于A的记录,如下面图2,而且,这个逻辑文件会用customer name来顺序读取数据,
Figure 1 - DDS for Logical File to Re-sequence Order of Records
A R CUREC PFILE(CUS)
A TEXT('CUST BY CITY / STATE')
*
A K CUCITY
A K CUSTAT
Figure 2 - DDS for Logical File to Select and Re-sequence
A R CUREC PFILE(CUS)
A TEXT('CUST NAME/ACTIVE ONLY')
A K CUNAME
*
A S CUSTAT COMP(EQ A)
|
|