Db2 在RPGLE-free中使用数组访问外部(DSPF)字段
在旧的Db2 在RPGLE-free中使用数组访问外部(DSPF)字段,db2,rpgle,Db2,Rpgle,在旧的RPG III和非自由RPGLE/RPG IV中,您可以从PF/LF记录或DSPF记录中“重命名”字段 这可能导致将多行输入(附加顺序文本)分组到一个数组中。因此,我不必将移动到外部描述字段x1txt1,ottxt2移动到x1txt2等等 我只需将LF记录和DSPF记录字段重命名为数组字段,读取记录并将它们从一个数组移到另一个数组,然后显示我的DSPF记录 H DECEDIT('0,') DATEDIT(*DMY.) dftactgrp(*no) Fsls001 cf e
RPG III
和非自由RPGLE/RPG IV
中,您可以从PF/LF
记录或DSPF
记录中“重命名”字段
这可能导致将多行输入(附加顺序文本)分组到一个数组中。因此,我不必将移动到外部描述字段x1txt1
,ottxt2
移动到x1txt2
等等
我只需将LF记录和DSPF记录字段重命名为数组字段,读取记录并将它们从一个数组移到另一个数组,然后显示我的DSPF
记录
H DECEDIT('0,') DATEDIT(*DMY.) dftactgrp(*no)
Fsls001 cf e workstn
Fordtxtl0 if e k disk
D ot s 20a dim(6)
D x1 s 20a dim(6)
Iordtxtr
I ottxt1 ot(1)
I ottxt2 ot(2)
I ottxt3 ot(3)
I ottxt4 ot(4)
I ottxt5 ot(5)
I ottxt6 ot(6)
Isls00101
I x1txt1 x1(1)
I x1txt2 x1(2)
I x1txt3 x1(3)
I x1txt4 x1(4)
I x1txt5 x1(5)
I x1txt6 x1(6)
C k$or00 klist
C kfld otonbr
C kfld otopos
C eval otonbr = 2
C eval otopos = 2
C k$or00 chain ordtxtr
C if %found(ordtxtl0)
C eval x1 = ot
C endif
C
C exfmt sls00101
C
C move *on *inlr
但是在*免费RPGLE
中也可以这样做吗?如果是,如何定义包含文件中字段的数据结构,并用数组覆盖它们
用这些数据结构替换I规范和数组定义。除了外部描述的文件中的字段名之外,您不必指定任何内容
dcl-ds otDs;
ottxt1;
ottxt2;
ottxt3;
ottxt4;
ottxt5;
ottxt6;
ot like(ottxt1) dim(6) pos(1);
end-ds;
dcl-ds x1Ds;
x1txt1;
x1txt2;
x1txt3;
x1txt4;
x1txt5;
x1txt6;
x1 like(x1txt1) dim(6) pos(1);
end-ds;
可以定义包含文件中字段的数据结构,并使用数组覆盖这些字段
用这些数据结构替换I规范和数组定义。除了外部描述的文件中的字段名之外,您不必指定任何内容
dcl-ds otDs;
ottxt1;
ottxt2;
ottxt3;
ottxt4;
ottxt5;
ottxt6;
ot like(ottxt1) dim(6) pos(1);
end-ds;
dcl-ds x1Ds;
x1txt1;
x1txt2;
x1txt3;
x1txt4;
x1txt5;
x1txt6;
x1 like(x1txt1) dim(6) pos(1);
end-ds;