• AS/400开发经验点滴(六)如何制作下拉菜单


    九.在AS/400上实现弹出下拉菜单

    1.步骤

    AS/400上使用下拉菜单的软件很少见,但下拉菜单的优点又显而易见,AS/400的SDA工具提供了制造下拉菜单的功能。

    用SDA创建显示文件,可以用多种RECORD类型可以选择:RECORD, USRDFN,SFL, SFLMSG,WINDOW, WDWSFL,PULDWN, PDNSFL,MNUBAR。其中的MNUBAR和PULDWN两种类型就是制造下拉菜单的两种必须类型。
                     
    使用SDA工具只需遵循以下六个步骤就可以创建下拉菜单:

    1. 用STRSDA启动SDA,选择DESIGN SCREEN
    2. 创建一个或多个类型为pull-down(PULDWN)的RECORD
    3. 创建一个类型menu-bar(MNUBAR)的RECORD
    4. 定义PULDWN RECORD的fields
    5. 定义MNUBAR RECORD的fileds
    6. 测试下拉菜单

    2. 显示文件

    这几步详细步骤信息可以参见SDA参考书。下面就是我创建的一个下拉菜单的示范显示文件:

         A*%%TS  SD  20040210  110218  BLOG        REL-V5R1M0  5722-WDS

         A*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

         A*                                                               *

         A* FILE NAME        : PULLMENU                                   *

         A* DESCRIPTION      : PULL DOWN MENU SAMPLE                      *

         A* VERSION          : 2.00                                       *

         A* PROGRAMMER       : BLOG LIOU                                  *

         A* CREATION DATE    : 1998.02.22 - V1.00                         *

         A* MODIFIED DATE    : 1998.05.08 - V2.00                         *

         A* MODIFIED DATE    : 2004.02.10 - V2.10                         *

         A*                                                               *

         A*################################################################

         A*%%EC

         A                                      DSPSIZ(24 80 *DS3)

         A                                      INVITE

         A                                      INDARA

         A                                      MNUBARSW(CA10)

         A                                      MNUCNL(CA12)

         A                                      HELP(01)

         A                                      CF02

         A                                      CF03

         A                                      CSRINPONLY

         A*                                     OVERLAY

         A*                                     MNUBARDSP(MENUBAR &MNUCHI &PULCHI)

         A          R APPSCR

         A*%%TS  SD  20040210  110218  BLOG        REL-V5R1M0  5722-WDS

         A                                      CSRLOC(LINNBR     POSNBR)

         A                                      RTNCSRLOC(*WINDOW &LINNBR &POSNBR)

         A                                      KEEP

         A            LINNBR         3S 0H

         A            POSNBR         3S 0H

         A                                 23  1'F1=HELP
     F2=SWITCH LINE MENU  F3=E-

         A                                      XIT F12=CANCEL                     -

         A                                                '

         A                                      DSPATR(RI)

         A                                      COLOR(BLU)

         A                                 11 26'= =  PULL DOWN MENU SAMPLE = ='

         A                                      COLOR(BLU)

         A                                 20 14'BLOGIMS VERSION 1.00, (C)COPYRIGHT-

         A                                       XXXXXXX CORP. 1998.'

         A                                      DSPATR(UL)

         A                                      COLOR(WHT)

         A*                                 3 63DATE

         A*                                     EDTCDE(Y)

         A*                                     DSPATR(HI)

         A*                                 3 72TIME

         A*                                     DSPATR(HI)

         A*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

         A          R MENUBAR

         A*%%TS  SD  19980518  164123  BLOG        REL-V3R7M0  5716-PW1

         A                                      RTNCSRLOC(*WINDOW &LINNBR &POSNBR)

         A                                      CSRLOC(LINNBR     POSNBR)

         A                                      OVERLAY

         A                                      KEEP

         A                                      MNUBAR

         A                                      MNUBARDSP(&PULCHI)

         A            LINNBR         3S 0H

         A            POSNBR         3S 0H

         A            PULCHI         2S 0H

         A            MNUCHI         2Y 0B  1  2CHCSLT((*COLOR PNK))

         A                                      MNUBARCHC(1 APULDWN '中心日终')

         A                                      MNUBARCHC(2 BPULDWN '查询处理')

         A                                      MNUBARCHC(3 CPULDWN '网络监视')

         A                                      MNUBARCHC(4 DPULDWN '报标管理')

         A                                      MNUBARCHC(5 EPULDWN '系统管理')

         A                                      MNUBARCHC(6 FPULDWN '数据维护')

         A*----------------------------------------------------------------

         A          R APULDWN

         A*%%TS  SD  19980510  083341  BLOG        REL-V3R7M0  5716-PW1

         A                                      PULLDOWN(*NOSLTIND)

         A            FLD001         2Y 0B  1  1SNGCHCFLD

         A                                      CHOICE(1 '>;1*********      ')

         A                                      CHOICE(2 '>;2      *********')

         A                                      CHOICE(3 '>;3      *********')

         A                                      CHOICE(4 '>;4      *********')

         A                                      CHOICE(5 '>;5      *********')

         A                                      CHOICE(6 '>;6      *********')

         A                                      CHOICE(7 '>;7      *********')

         A                                      CHOICE(8 '>;8      *********')

         A                                      CHOICE(9 '>;9      *********')

         A                                      CHOICE(10 '>;A      *********')

         A                                      CHOICE(11 '>;B      *********')

         A                                      CHOICE(12 '>;C      *********')

         A                                      CHOICE(13 '>;D      *********')

         A                                      CHOICE(14 '>;E      *********')

         A          R BPULDWN

         A*%%TS  SD  19980508  220549  BLOG        REL-V3R7M0  5716-PW1

         A                                      PULLDOWN

         A            FLD001         2Y 0B  1  1CHOICE(1 '  *********    ')

         A                                      CHOICE(2 '      *********')

         A                                      CHOICE(3 '      *********')

         A                                      CHOICE(4 '     ********* ')

         A                                      CHOICE(5 '      *********')

         A                                      CHOICE(6 '      *********')

         A                                      SNGCHCFLD

         A          R CPULDWN

         A*%%TS  SD  19980508  220549  BLOG        REL-V3R7M0  5716-PW1

         A                                      PULLDOWN

         A            FLD001         2Y 0B  1  1SNGCHCFLD

         A                                      CHOICE(1 '      *********')

         A                                      CHOICE(2 '     ********* ')

         A                                      CHOICE(3 '      *********')

         A          R DPULDWN

         A*%%TS  SD  19980508  220549  BLOG        REL-V3R7M0  5716-PW1

         A                                      PULLDOWN

         A            FLD001         2Y 0B  1  1SNGCHCFLD(*RSTCSR)

         A                                      CHOICE(1 '      *********')

         A                                      CHCUNAVAIL((*COLOR BLU))

         A          R EPULDWN

         A*%%TS  SD  19980508  220549  BLOG        REL-V3R7M0  5716-PW1

         A                                      PULLDOWN

         A            FLD001         2Y 0B  1  1SNGCHCFLD

         A                                      CHOICE(1 '    *********')

         A                                      CHOICE(2 '    *********')

         A                                      CHOICE(3 '    *********')

         A                                      CHOICE(4 '    *********')

         A**                                    CHOICE(5 '    *********')

         A                                      CHOICE(5 '    *********')

         A          R FPULDWN

         A*%%TS  SD  19980508  160451  BLOG        REL-V3R7M0  5716-PW1

         A                                      PULLDOWN(*NOSLTIND)

         A            FLD001         2Y 0B  1  1SNGCHCFLD

         A                                      COLOR(BLU)

         A                                      CHOICE(1 '>;1    *********')

         A                                      CHOICE(2 '>;2     *********')

         A                                      CHOICE(3 '>;3   *********')

         A                                      CHOICE(4 '>;4   *********')

         A                                      CHOICE(5 '>;5    *********')

         A                                      CHOICE(6 '>;6    *********')

         A                                      CHOICE(7 '>;7    *********')

         A                                      CHOICE(8 '>;8     *********')

         A                                      CHOICE(9 '>;9     *********')

         A                                      CHOICE(10 '>;A     *********')

         A                                      CHOICE(11 '>;B    *********')

         A                                      CHOICE(12 '>;C    *********')

         A                                      CHOICE(13 '>;D    *********')


    3. RPG程序

    但是光有显示文件还不行,必须与高级程序(RPG或CL)结合起来,才能完成下显拉菜单的程序调用功能。要使RPG程序知道正确的调用,RPG程序就必须知道示文件当前的选择。这个选择是有两项组成,一个是MNUBAR的当前选择,一个PULDWN的选择。这两个选择项都是在显示文件的MNUBAR RECORD定义的,分别是MNUCHI和PULCHI,要在显示文件里正确获得这两项值,还必须在MNUBAR RECORD里定义当前光标位置,这是由定义LINNBR和POSNBR两个变量来体现的。初学者常犯的一个错误就是:已成功创建下拉菜单显示文件,但在RPG程序中却无法成功调用应用程序,问题就出在这里。

    有了MNUCHI和PULCHI,那么在RPG程序中就可以准确知道当前的选择,从而分别调用相应的程序。调用程序方式可以多种多样,可以直接调用,也可以把程序名写在一个PF文件里,动态调用。下面示范RPG程序中MNUCHI为CENTER的调用就是用参数文件来实现的,其他全部直接调用。

    比如定义MENUPGM的PF文件来存放调用程序名:

         A*

         A                                      UNIQUE

         A          R MNUPGM

         A            MNUCHI         2S 0

         A            PULCHI         2S 0

         A            PDNPGM        10A

         A          K MNUCHI

         A          K PULCHI

    下面是RPG程序:

         H*################################################################

         H*                                                               *

         H* PROGRAM NAME   : PULLMENUR                                    *

         H* VERSION        : 2.00                                         *

         H* FUNCTION       :                                              *

         H* PROGRAMMER     : BLOG LIOU                                    *

         H* MODIFIED BY    :                                              *

         H* CREATION DATE  : 1998.02.19 - V1.00                           *

         H* MODIFIED DATE  : 1998.05.08 - V2.00                           *

         H* MODIFIED DATE  : 2004.02.10 - SAMPLE                          *

         H*                                                               *

         H*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

         FMENUPGM IF  E           K        DISK

         FPULLMENUCF  E                    WORKSTN

         I*--------------------------------------------------------------

         I           SDS

         I                                     *STATUS  STATUS

         C*--------------------------------------------------------------

         C                     MOVE *BLANK    PGMNAM  8

         C           CHIKEY    KLIST

         C                     KFLD           MNUCHI              

         C                     KFLD           PULCHI              

         C*

         C*################################################################

         C*

         C           MNMENU    TAG

         C                     Z-ADD2         POSNBR

         C           MENULP    TAG

         C                     Z-ADD1         LINNBR

         C                     WRITEAPPSCR

         C                     EXFMTMENUBAR

         C           *INKC     IFEQ *ON

         C                     GOTO ENDPGM

         C                     ENDIF

         C           MNUCHI    CASEQ1         CENTER              

         C           MNUCHI    CASEQ2         DATQRY              

         C           MNUCHI    CASEQ3         NETMON              

         C           MNUCHI    CASEQ4         RPTPRT              

         C           MNUCHI    CASEQ5         SYSADM              

         C           MNUCHI    CASEQ6         DATMNT              

         C                     ENDCS

         C           *INKB     IFEQ '1'

         C                     CALL 'ALTMENU'

         C                     ENDIF

         C                     GOTO MENULP

         C           ENDPGM    TAG

         C                     SETON                     LR

         C                     RETRN

         C*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

         C*

         C*      --------------------------------------------------

         C           CENTER    BEGSR

         C                     Z-ADDPULCHI    XZXM    20

         C           CHIKEY    CHAINMNUPGM               60

         C  N60                MOVE PDNPGM    PGMNAM

         C                     CALL PGMNAM

         C                     PARM '0000'    RMSG    4

         C           EXTRZ     ENDSR

         C*----------------------------------------------------------------

         C           DATQRY    BEGSR                              

         C                     SELEC

         C           PULCHI    WHEQ 1

         C                     CALL 'DSPWDZT'                     

         C           PULCHI    WHEQ 2

         C                     CALL 'AMDSPDB'

         C           PULCHI    WHEQ 3

         C                     CALL 'QRYLSZH'

         C           PULCHI    WHEQ 4                             

         C                     CALL 'DSPRZF'

         C           PULCHI    WHEQ 5                              

         C   60                MOVEL'CXKMGZ'  PGMNAM

         C                     CALL PGMNAM                 56

         C  N56                FREE PGMNAM

         C           PULCHI    WHEQ 6                             

         C   60                MOVEL'CXZZXX'  PGMNAM

         C                     CALL PGMNAM                 56

         C  N56                FREE PGMNAM

         C                     ENDSL

         C                     ENDSR

         C*----------------------------------------------------------------

         C           NETMON    BEGSR                              

         C                     SELEC

         C           PULCHI    WHEQ 1

         C                     CALL 'WATCHNH'

         C           PULCHI    WHEQ 2

         C                     CALL 'WATCHRH'

         C           PULCHI    WHEQ 3

         C                     CALL 'WATCHHH'

         C                     ENDSL

         C                     ENDSR

         C*----------------------------------------------------------------

         C           RPTPRT    BEGSR                              

         C                     CALL 'BBMENU'

         C                     ENDSR

         C*----------------------------------------------------------------

         C           SYSADM    BEGSR                              

         C                     SELEC

         C           PULCHI    WHEQ 1

         C                     CALL 'MNTJGDY'

         C           PULCHI    WHEQ 2

         C                     CALL 'MNTGYDY'

         C           PULCHI    WHEQ 3

         C                     CALL 'BAKACDAT'

         C           PULCHI    WHEQ 4

         C                     CALL 'RSTACDAT'

         C           PULCHI    WHEQ 5

         C                     CALL 'MNTQLSJ'

         C                     ENDSL

         C                     ENDSR

         C*----------------------------------------------------------------

         C           DATMNT    BEGSR                              

         C                     SELEC

         C           PULCHI    WHEQ 1

         C   60                MOVEL'MNTKMDM' PGMNAM

         C                     CALL PGMNAM

         C           PULCHI    WHEQ 2

         C                     CALL 'MNTJYDM'

         C           PULCHI    WHEQ 3

         C                     CALL 'MNTLLDM'

         C           PULCHI    WHEQ 4

         C                     CALL 'MNTHLDM'

         C           PULCHI    WHEQ 5

         C                     CALL 'MNTYWLB'

         C           PULCHI    WHEQ 6

         C                     CALL 'MNTPZDM'

         C           PULCHI    WHEQ 7

         C                     CALL 'MNTZDDM'

         C           PULCHI    WHEQ 8

         C                     CALL 'MNTRQDM'

         C           PULCHI    WHEQ 9

         C                     CALL 'MNTXJDM'

         C           PULCHI    WHEQ 10

         C                     CALL 'MNTCSDM'

         C           PULCHI    WHEQ 11

         C                     CALL 'MNTCDDY'

         C           PULCHI    WHEQ 12

         C                     CALL 'MNTSQLB'

         C           PULCHI    WHEQ 13

         C                     CALL 'MNTXYMM'

         C                     ENDSL

         C                     ENDSR

         C*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&

         C           *PSSR     BEGSR

         C                     GOTO MNMENU

         C                     ENDSR

         C*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@


    上面的示范程序实际编译通过,可以作为创建下拉菜单参考。也可以直接修改本示范程序而不是通过SDA定义来创建下拉菜单。

  • 相关阅读:
    树形DP求树的最小支配集,最小点覆盖,最大独立集
    贪心法求树的最小支配集,最小点覆盖,最大独立集
    树上两点的最近公共祖先问题(Least Common Ancestors)
    大厂前端面试题
    表单中包含上传图片
    element-ui表单验证
    一、React基础
    点击div上传图片,在img中预览
    持久化
    docker安装
  • 原文地址:https://www.cnblogs.com/etsdpt/p/2317073.html
Copyright © 2020-2023  润新知