代码之家  ›  专栏  ›  技术社区  ›  Radinator

使用RPGLE free中的数组访问外部(DSPF)字段

  •  1
  • Radinator  · 技术社区  · 5 年前

    RPG III 和非自由的 RPGLE/RPG IV 您可以“重命名”从 PF/LF 或者一张来自 DSPF

    这可能导致将多行输入(额外的订单文本)组合成一个数组。所以我不必 MOVEL EVAL ottxt1 到外部描述字段 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 
    

    但是这也有可能在 *FREE RPGLE

    1 回复  |  直到 5 年前
        1
  •  4
  •   Barbara Morris    5 年前

    可以定义包含文件中字段的数据结构,并用数组覆盖它们。

    用这些数据结构替换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;