View the last cursor position on the screen

Learn how to get the help function on the screen at a certain field in this tip.

Easy and friendly is what users want when launching a new application program. A common question among users is

how to get the help function on the screen at a certain field (i.e. customer code and item number). As illustration in my tip below, we can view the last position row and column on the screen. When cursor position is at customer code field, and F4 is *on program will view the customer master list and son on.

Three sources are needed:

1. Physical file-XDSP#
2. Display file -SCREEN1
3. RPG program-PVIEW.

Compile that source and call that RPG program.


 1. RPG source program (PVIEW)
 
     1      H        1   M/                                                                                            07/03/02
  1201      FSHOW1   CF  E                    WORKSTN                                                                  07/03/02
  1204      F                                              KINFDS INFDS#                                               07/03/02
  2148      IINFDS#    E DSXDSP#                                                                                       07/03/02
  5200      C*****************************************************************                                         07/03/02
  5300      C*  MAIN PROCESS                                                 *                                         07/03/02
  5400      C*****************************************************************                                         07/03/02
  5401      C           *IN03     DOWEQ'0'                                                                             07/03/02
  5800      C                     EXFMTSHOF                                                                            07/03/02
  5801      C           *IN04     IFEQ '1'                                                                             07/03/02
  5802      C                     EXSR RCTEST                                                                          07/03/02
  5803      C           DROW      IFEQ 4                                                                               07/03/02
  5804      C           DCOL      ANDGE22                                                                              07/03/02
  5805      C           DCOL      ANDLE29                                                                              07/03/02
  5806      C                     EXFMTDCUS                                                                            07/03/02
  5807      C                     ELSE                                                                                 07/03/02
  5808      C           DROW      IFEQ 6                                                                               07/03/02
  5809      C           DCOL      ANDGE22                                                                              07/03/02
  5810      C           DCOL      ANDLE36                                                                              07/03/02
  5811      C                     EXFMTDITM                                                                            07/03/02
  5812      C                     END                                                                                  07/03/02
  5813      C                     END                                                                                  07/03/02
  5814      C                     END                                                                                  07/03/02
  5815      C                     END                                                                                  07/03/02
  5816      C                     MOVE '1'       *INLR                                                                 07/03/02
  5818      C* Extract cursor row and column                                                                           07/03/02
  5817      C           RCTEST    BEGSR                                                                                07/03/02
  5819      C           @#RWCL    DIV  256       DROW                                                                  07/03/02
  5820      C                     MVR            DCOL                                                                  07/03/02
  5900      C                     ENDSR                                                                                07/03/02

* * * *  E N D  O F  S O U R C E  * * * *

2. Physical File Source (XDSP#)
 
   
   800      A          R @INFDS#                                                                                       07/03/02
   900      A            @#XX00        10          TEXT('FILLER')                                                      07/03/02
  1000      A            @#STCD         5S 0       TEXT('*STATUS')                                                     07/03/02
  1100      A            @#OPCD         6          TEXT('OPERATION CODE')                                              07/03/02
  1200      A            @#SBRT         8          TEXT('SUBROUTINE NAME')                                             07/03/02
  1201      A            @#SRSQ         8          TEXT('SOURCE SEQUENCE #')                                           07/03/02
  1202      A            @#XX01         8          TEXT('FILLER')                                                      07/03/02
  1203      A            @#MSID         7          TEXT('MACHINE OR SYSTEM ME-                                         07/03/02
  1204      A                                          SSAGE ID')                                                      07/03/02
  1205      A            @#XX02        14          TEXT('FILLER')                                                      07/03/02
  1206      A            @#SCSZ         4S 0       TEXT('SCREEN SIZE')                                                 07/03/02
  1207      A            @#XX81        81          TEXT('FILLER')                                                      07/03/02
  1208      A            @#SCRW         2B 0       TEXT('# ROWS ON DISPLAY/PAGE')                                      07/03/02
  1209      A            @#SCCL         2B 0       TEXT('# OF COLUMNS ON DISPLAY/-                                     07/03/02
  1210      A                                          PAGE')                                                          07/03/02
  1211      A            @#XX06       105          TEXT('FILLER')                                                      07/03/02
  1212      A            @#DFMT        10          TEXT('DEVICE FORMAT')                                               07/03/02
  1213      A            @#XX04        99          TEXT('FILLER')                                                      07/03/02
  1214      A            @#RWCL         4B 0       TEXT('ROW * 256 + COLUMN')                                          07/03/02
  1215      A            @#XX05         6          TEXT('FILLER')                                                      07/03/02
  1216      A            @#SFRC         4B 0       TEXT('SFLRCD AFTER ROLL KEY')                                       07/03/02
  1217      A            @#XX07         2          TEXT('FILLER')                                                      07/03/02
  1218      A            @#WWRC         4B 0       TEXT('WDW-  ROW * 256 + COLUMN')                                    07/03/02

* * * *  E N D  O F  S O U R C E  * * * *
3. Display file source (SHOW1)

    10      A*%%TS  SD  20020703  101104  EDP1        REL-V4R2M0  5769-PW1                                             07/03/02
    20      A*%%EC                                                                                                     07/03/02
    30      A                                      DSPSIZ(24 80 *DS3)                                                  07/03/02
    40      A                                      CA03(03 'EXIT')                                                     07/03/02
    50      A                                      CA04(04 'PROMPT')                                                   07/03/02
    60      A          R SHOF                                                                                          07/03/02
    70      A*%%TS  SD  20020703  101104  EDP1        REL-V4R2M0  5769-PW1                                             07/03/02
    80      A                                  2 23'Customer Order Entry'                                              07/03/02
    90      A                                  4  6'Customer Code :'                                                   07/03/02
   100      A            DCUSC          8A  B  4 22                                                                    07/03/02
   110      A                                  6  6'Item Number...:'                                                   07/03/02
   120      A            DITNBR        15A  B  6 22                                                                    07/03/02
   130      A                                 22  7'F3=Exit'                                                           07/03/02
   140      A                                  8  6'Cursor position :'                                                 07/03/02
   150      A                                 10 22'Row    ='                                                          07/03/02
   160      A                                 11 22'Column ='                                                          07/03/02
   170      A            DROW           5S 0O 10 32                                                                    07/03/02
   180      A            DCOL           5S 0O 11 32                                                                    07/03/02
   190      A                                 22 16'F4=Prompt'                                                         07/03/02
   200      A          R DCUS                                                                                          07/03/02
   210      A*%%TS  SD  20020703  100702  EDP1        REL-V4R2M0  5769-PW1                                             07/03/02
   220      A                                      WINDOW(6 20 10 40)                                                  07/03/02
   230      A                                  1  8'Customer Master List'                                              07/03/02
   240      A                                      DSPATR(HI)                                                          07/03/02
   250      A          R DITM                                                                                          07/03/02
   260      A*%%TS  SD  20020703  100702  EDP1        REL-V4R2M0  5769-PW1                                             07/03/02
   270      A                                      WINDOW(6 30 10 40)                                                  07/03/02
   280      A                                  1  8'Item Number List'                                                  07/03/02
   290      A                                      DSPATR(HI)                                                          07/03/02


* * * *  E N D  O F  S O U R C E  * * * * 
This was first published in July 2002

Dig deeper on iSeries CL programming

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchEnterpriseLinux

SearchDataCenter

Close