[英]Accessing external (DSPF) fields using arrays in RPGLE free
In the old RPG III
and the non-free RPGLE/RPG IV
you could "rename" fields you get from either a record of a PF/LF
or a record from a DSPF
. 在旧的
RPG III
和非免费的RPGLE/RPG IV
您可以“重命名”从PF/LF
记录或DSPF
记录中获得的DSPF
。
This lead to possibilities like grouping several lines of input (additional order text) into a array. 这导致了诸如将几行输入(附加命令文本)分组到一个数组中的可能性。 So I didn't have to
MOVEL
or EVAL
ottxt1
to the external described field x1txt1
, ottxt2
to x1txt2
and so on. 因此,我不必
MOVEL
或EVAL
ottxt1
到外部描述的字段x1txt1
, ottxt2
到x1txt2
等等。
I'd only had to rename the LF record and the DSPF record fields to the array-fields, read the record and shift them from the one array to the other and display my DSPF
record 我只需要将LF记录和DSPF记录字段重命名为array-field,读取记录并将它们从一个数组移到另一个数组,然后显示我的
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
But is this also possible in *FREE RPGLE
? 但这在
*FREE RPGLE
也是可能的吗? And if so, how? 如果是这样,怎么办?
You can define data structures containing the fields from the files, and overlay them with an array. 您可以定义包含文件中字段的数据结构,并用数组覆盖它们。
Replace your I specs and array definitions with these data structures. 用这些数据结构替换您的I spec和数组定义。 You don't have to specify anything besides the field names for the fields from the externally-described file.
除了外部描述文件中字段的字段名称外,您无需指定其他任何内容。
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;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.