分类: 系统运维
2012-07-04 16:07:00
DS是的缩写。概念性的东西就不多讲了,IBM i的信息中心上有很多,请点击前面的连接查看。
不过RPGLE中提供了4中特殊的DS,即UDS, SDS, INFDS和INDDS。 有些DS在后面的练习会陆续讲到。
EX7
0010.00 D QualFile 0011.00 D LibName 10A overlay(QualFile) 0012.00 D Separate 1A overlay(QualFile:11) Inz('/') 0013.00 D FileName 10A overlay(QualFile:12) 0014.00 D Error 0015.00 D MsgId 7A overlay(Error) 0016.00 D MsgData 20A overlay(Error:*next) 0017.00 D* 0018.00 D I S 1S 0 0019.00 D Wait S 1A 0020.00 c* 0021.00 C Eval FirstName = 'Terry' 0022.00 C Eval LastName = 'Pan' 0023.00 C Eval Age = 30 0024.00 C People Dsply 0025.00 C* 0026.00 C For I = 1 To 2 0027.00 C Eval Peoples(I).FirstName = 'Terry' + %char(I) 0028.00 C Eval Peoples(I).LastName = 'Pan' 0029.00 C Eval Peoples(I).Age = 30 + I 0030.00 C EndFor 0031.00 C Peoples(1) Dsply 0032.00 C Peoples(2) Dsply 0033.00 C* 0034.00 C Eval Format.FileName = 'QRPGLESRC' 0035.00 C Eval Format.LibName = 'PTRLIB' 0036.00 C Eval Format.MsgId = 'CTS0001' 0037.00 C Eval Format.MsgData = 'Not found the Data' 0038.00 C Format Dsply 0039.00 C* 0040.00 C 'Complete' Dsply Wait 0041.00 C* 0042.00 C Eval *inlr = *on 0043.00 C Return
EX7F
0001.00 D People DS 0002.00 D Name 0003.00 D FirstName 10A overlay(Name) 0004.00 D LastName 10A overlay(Name:*next) 0005.00 D Age 3S 0 0006.00 D* 0007.00 D Peoples DS Dim(2) LikeDS(People) 0008.00 D* 0009.00 D Format DS QUALIFIED 0010.00 D QualFile 0011.00 D LibName 10A overlay(QualFile) 0012.00 D Separate 1A overlay(QualFile:11) Inz('/') 0013.00 D FileName 10A overlay(QualFile:12) 0014.00 D Error 0015.00 D MsgId 7A overlay(Error) 0016.00 D MsgData 20A overlay(Error:*next) 0017.00 D* 0018.00 D I S 1S 0 0019.00 D Wait S 1A 0020.00 /free 0021.00 FirstName = 'Terry'; 0022.00 LastName = 'Pan'; 0023.00 Age = 30; 0024.00 Dsply People; 0025.00 0026.00 For I = 1 To 2; 0027.00 Peoples(I).FirstName = 'Terry' + %char(I); 0028.00 Peoples(I).LastName = 'Pan'; 0029.00 Peoples(I).Age = 30 + I; 0030.00 EndFor; 0031.00 Dsply Peoples(1); 0032.00 Dsply Peoples(2); 0033.00 0034.00 Format.FileName = 'QRPGLESRC'; 0035.00 Format.LibName = 'PTRLIB'; 0036.00 Format.MsgId = 'CTS0001'; 0037.00 Format.MsgData = 'Not found the Data'; 0038.00 Dsply Format; 0039.00 Dsply 'Complete' '' Wait; 0040.00 0041.00 *inlr = *on; 0042.00 return; 0043.00 0044.00 /end-free 当然这只是个简单使用DS的例子。在信息中心中也有不少例子,大家可以去看一下.