动态、指针field-symbols初探

DATA: BEGIN OF STRUC,
        COMP1 TYPE C LENGTH 1 VALUE '1',
        COMP2 TYPE C LENGTH 20 VALUE '22222',
        COMP3 TYPE STRING VALUE 'bruce king',
      END OF STRUC,
      COMP_VALUE TYPE C LENGTH 10 VALUE 'value',
      COMP_NAME  TYPE C LENGTH 15.

FIELD-SYMBOLS: <FS> .
"指派结构的一个字段给<fs>
ASSIGN STRUC-COMP1 TO <FS>.  WRITE:/ '第一个',<FS>. " 输出:1
"指派结构字段的基地址加上两倍此字段长度的地址给字段符号
ASSIGN STRUC-COMP1 INCREMENT 2 TO <FS>. WRITE:/ '第二个',<FS>. " 输出: b
"指派结构的第二个组件字段给字段符号
ASSIGN COMPONENT 2 OF STRUCTURE STRUC TO <FS>.  WRITE:/ '第三个',<FS>. " 输出:abcdefg

ASSIGN COMPONENT 3 OF STRUCTURE STRUC TO <FS>. WRITE:/ '第四个',<FS>.
"动态指定字段名,一般不用
COMP_NAME = 'comp_value'.
ASSIGN (COMP_NAME) TO <FS>. WRITE:/ '第五个',<FS>. "输出:value
ASSIGN COMP_NAME TO <FS>. WRITE:/ '第六个',<FS>. "输出:comp_value

 动态、指针field-symbols初探

 

上一篇:Android 滑动界面实现---Scroller类别 从源代码和开发文档了解(让你的移动布局)


下一篇:解决wps for linux缺失windows字体