HP 3000 Manuals

Actions Not Modified [ HP RPG/iX Reference Manual Software Update Notice ] MPE/iX 5.0 Documentation


HP RPG/iX Reference Manual Software Update Notice

Actions Not Modified 

The actions that have not been modified are:

CHGNXT                Does not call any intrinsics.  May modify COMAREA
                      items NFNAME, REPEATAPP, FREEZAPP, depending on
                      content of record.

GETNXT                Calls VGETNEXTFORM. If not in browse mode, calls
                      VPUTBUFFER, blanking out the VPLUS data buffer.

PUTMSG                Calls VPUTWINDOW. If the output buffer column 7 is
                      not blank, the COMAREA item WINDOWENH is modified.

BADFLD                Calls VSETERROR. May modify COMAREA item WINDOWENH
                      depending on the value in the output buffer column
                      14.

PUTDTA                Calls VPUTBUFFER.

INIT                  Calls VINITFORM.

EDITS                 Calls VEDITFIELDS.

NUMERR                No intrinsic calls.  Sets the event code to 9.  A
                      following READ operation places the number of
                      fields that failed a VPLUS or user edit operation
                      into the Input Specification field allocated for
                      this value.

GETDTA                No intrinsic calls.  Sets the event code to 10.  A
                      following READ operation calls VGETBUFFER. No
                      change from previous behavior for this call.

FINISH                Calls VFINISHFORM.

WRTBAT                Calls VWRITEBATCH. Sets the COMAREA item DELETEFLAG
                      to false prior to the call.  On return, if not in
                      browse mode and there is no error, the COMAREA item
                      RECNUM is incremented.

PREV                  Calls VREADBATCH. If not in browse mode, will set
                      the COMAREA item CMODE to 'browse'.

REREAD                Calls VREADBATCH.

NEXT                  Calls VREADBATCH.

RESUME                No intrinsic calls.  Sets the COMAREA item CMODE to
                      'collect', and restores RECNUM and NFNAME to the
                      values saved during a PREV action.

DELETE                Calls VWRITEBATCH. Sets the COMAREA item DELETEFLAG
                      to true.

RDBTNU                Calls VREADBATCH. Sets the COMAREA item RECNUM to
                      the record to be read.

GETFLD                No intrinsic calls.  Sets the event code to 12.  A
                      following READ operation calls VGETFIELD. No change
                      from previous behavior for this call.

PUTFLD                Calls VPUTFIELD.

LOADFM                Calls VLOADFORMS.

UNLDFM                Calls VUNLOADFORM.

Changing Data in COMAREA 

As mentioned previously, reading or changing data in the COMAREA is
somewhat tricky because it contains a mix of data, and RPG does not have
an internal binary data type.  The method chosen to handle this is to
declare the array *VC as an alphanumeric array of one character per
element.

To read the data, you must do so one character at a time.  There are no
conversion routines to make binary data readable (like DSPLY), but you
can check the data using the COMP or TESTB operators.  Alphanumeric data
in the COMAREA (form names) can be displayed one character at a time.  To
modify binary data, you must create the desired bit pattern yourself
using the BITOF and BITON operators.

Example 1.   

Suppose you want to set the window enhancement to "B".  Because this is
alphanumeric, it is easier.  You need to modify the right byte of COMAREA
word 8, which is *VC,16.  The operation here is:

          C                     MOVE "B"       *VC,16

To set the COMAREA length (word 3) to 60, note that the binary equivalent
of 60 is '0000000000111100' (see any good computer science book for
information on decimal to binary conversion).  To set the length, clear
and then set bytes 5 and 6.  The operations here are:

          C                     BITOF"01234567"*VC,5
          C                     BITOF"01234567"*VC,6
          C                     BITON"2345"    *VC,6

Note that "MOVE 0 *VC,5" or "Z-ADD0 *VC,5", etc.  will not work.  MOVE
places an ASCII '0' into the left byte of the 'length' word, and Z-ADD
yields a compile-time warning 6063 (result field must be numeric) and
does not produce code for the operation.

Example 2.   

As another example, suppose you want to set retries to 8 instead of the
default of 4.  This is word 55 (bytes 109 and 110) of the COMAREA. The
bit pattern for byte 110 is '00001000'.  However, the result field is
only 6 characters long, and cannot hold the byte reference *VC,110.  Use
a variable with a short name such as X to hold the value of the index.

          C                     Z-ADD109       X       30
          C                     BITOF"01234567"*VC,X
          C                     Z-ADD110       X
          C                     BITOF"01234567"*VC,X
          C                     BITON"4"       *VC,X

Example 3.   

Here are some coding examples.  Suppose you are in a noisy environment
and you would like to protect the SHOW action by retrying it five times
with a 3 second pause between retries, in the event of a VSHOWFORM
failure.  The following example shows how to do this:

          $CONTROL VPLUSCOM
          H
                                   .
                                   .
          C                     Z-ADD0         X       20
          C                     Z-ADD3         TIME    40
          C                     SETON                     80
          C           AGAIN     TAG
          C                     EXCPT
          C           *VSTAT    COMP 0                    9191
          C  N91                GOTO AOK
          C                     SETOF                     91
          C           X         IFEQ 5
          C                     GOTO ABORT
          C                     END
          C                     ADD  1         X
          C                     INTR PAUSE
          C                     IPARM          TIME
          C                     Z-ADD0         *VSTAT
          C                     GOTO AGAIN
          C           AOK       TAG
          C                     SETOF                     80
          C                       .
          C                       .
          C           ABORT     TAG
          C                       .
          C                       .
          OTERMINALE        80
          O                                    6 "SHOW  "

Example 4.   

As another example, suppose you want to do your own batch file
operations.  You want to check the COMAREA status on a VWRITEBATCH call,
and display an error message if it is non-zero.  (Note:  if you have a
form on your screen while executing the following code, it would mess it
up.)  The code for doing this follows:

          $CONTROL VPLUSCOM
          H
                                  .
                                  .
          E                    BUFR        1 72
                                  .
                                  .
          C                     Z-ADD0         *VSTAT
          C                     INTR VWRITEBATCH
          C                     IPARM          *VC
          C           *VSTAT    COMP 0                    9191
          C   91                EXSR WRBBAD
                                  .
                                  .
          CSR         WRBBAD    BEGSR
          C                     SETOF                     91
          C                     Z-ADD72        BUFLEN  40
          C                     Z-ADD0         ACTLEN  40       no. chars returned
          C* do not clear the comarea status word.  we need it here.
          C                     INTR VERRMSG
          C                     IPARM          *VC
          C                     IPARM          BUFR
          C                     IPARM          BUFLEN
          C                     IPARM          ACTLEN
          C* display the message.
          C           BUFR      DSPLY
          C* pause 10 seconds to allow it to be read.
          C                     Z-ADD10        TIME    40
          C                     INTR PAUSE
          C                     IPARM          TIME
          C* reset status to zero.
          C                     Z-ADD0         *VSTAT
          C                     ENDSR

Using the VPLUS Environment 

Once RPG/iX has opened the workstation, you can use the INTR and IPARM
operators, *VSTAT, and *VC to write your VPLUS applications using the
VPLUS intrinsics.  If you use a mix of RPG actions and intrinsic calls,
you must be aware that the actions in general do more than just call the
intrinsics.  For example, if you do a SHOW action, RPG will update the
COMAREA word 34 (SHOWCONTROL) bit 9 (PRE-LOAD) based on the value in
column 7 of the Output Specification record for SHOW (blank, 'P', or
invalid).  This would modify anything you put in that spot prior to the
action.

A problem that currently exists in the RPG VPLUS interface is that, if
you wish to do an EDITS action on data in the VPLUS buffer following an
RDTERM action, you lose the ability to use the f1-f8 function keys.  In
other words, if you respond to RDTERM with f1-f8, do the EDITS, and then
do a READ TERMINAL, the F1-F8 indicators do not get set.

A Complete Sample Program 

The following program uses the new enhancement which overcomes the
problem described above.  The forms file is not presented.  If you wish
to run this program, you would need to create your own forms file with
appropriate fields.

          * This program shows how to use the new VPLUS enhancement,
          * both in accessing the COMAREA and in using INTR/IPARM oper-
          * ators.  If you enter data and press ENTER, editing data as
          * needed, the data will be copied to MPEFILE.  If you press
          * f1-f7,no data is read.  Instead the form is
          * redisplayed, and you may enter different data.  If you press f8,
          * the program terminates.
          * To do the EDITS operation, do the following:
          * Do a SHOW followed by a RDTERM action, and then use the new
          * capability to call VFIELDEDITS.  Then access the COMAREA to
          * see if f8 was the last key pressed, and if so terminate the
          * program.  If f8 was not the last key pressed, check the
          * 'numerrs' value; if it is non-zero, try again, with an error message
          * in the window.  If no errors are found, the program continues.
          *
          $CONTROL VPLUSCOM
          H
          F***************************************************************
          F*               File Specifications                           *
          F***************************************************************
          FTERM    UD  V     110            WORKSTN   L3B
          F                                              KFORMS VPFORMS
          FMPEFILE O   F      72            DISC
          E***************************************************************
          E*               Array Specifications                          *
          E***************************************************************
          E                    ERM     1   1 79
          E                    MSG        79  1
          I***************************************************************
          I*               Input Specifications                          *
          I***************************************************************
          ITERM    AA  01   1 C0   2 C0   7 C1
          I       OR        1 C1   2 C0   7 C1
          I                                        1   20EVENT
          I                                        3  17 FORM
          I                                       18  210LENGTH
          I                                       22  270DIGIT
          I                                       28  33 ALPHA
          I*
          I* Define function key f1, f2, f3, f4, f5, f6, f7, f8.
          I*
          ITERM    BB  11   1 C0   2 C1
          I       OR   11   1 C0   2 C2
          I       OR   11   1 C0   2 C3
          I       OR   11   1 C0   2 C4
          I       OR   11   1 C0   2 C5
          I       OR   11   1 C0   2 C6
          I       OR   11   1 C0   2 C7
          I       OR   18   1 C0   2 C8
          C***************************************************************
          C*               Calculation Specifications                    *
          C***************************************************************
          C                     BITOF"01234567"X       1
          C           START     TAG
          C                     SETOF                     0111
          C                     SETOF                     18
          C                     EXSR GETNXT
          C                     EXSR SHOW
          C                     EXSR EDITS
          C   18                GOTO ENDPGM
          C   11                GOTO START
          C                     EXCPT          RECOUT
          C                     GOTO START
          C           ENDPGM    TAG
          C                     SETON                     LR
          C***************************************************************
          C*               Subroutine GETNXT                             *
          C*   INIT   = Initialize fields in current form                *
          C***************************************************************
          C           GETNXT    BEGSR
          C                     MOVE "GETNXT"  ACTION  6
          C                     EXCPT          ACTOUT
          C                     MOVE "INIT  "  ACTION
          C                     EXCPT          ACTOUT
          C                     ENDSR
          C***************************************************************
          C*               Subroutine SHOW                               *
          C*   SHOW  = Display current form, initial data, any           *
          C*           messages.                                         *
          C*   RDTERM= Read input from terminal to data buffer.          *
          C***************************************************************
          C           SHOW      BEGSR
          C  N90                MOVEAERM,1     MSG
          C  N90                EXSR SHOMSG
          C                     MOVE "SHOW  "  ACTION
          C                     EXCPT          ACTOUT
          C                     EXSR RDTERM
          C                     ENDSR
          C***************************************************************
          C*               Subroutine SHOMSG                             *
          C*   DISPLAY MESSAGE, ANY NEW DATA.                            *
          C***************************************************************
          C           SHOMSG    BEGSR
          C                     SETON                     54
          C                     EXCPT
          C                     SETOF                     54
          C                     ENDSR
          C***************************************************************
          C*               Subroutine EDITS                              *
          C*    EDITS = Perform edits on fields in current form.         *
          C*    FINISH= Perform final processing on current form.        *
          C*    GETDTA= Write data in data buffer to user program.       *
          C***************************************************************
          C           EDITS     BEGSR
          C                     SETOF                     90
          C           AGAIN     TAG
          C   11                SETOF                     11
          C   18                GOTO ENDEDT
          C   90                EXSR SHOW
          C* this is where the new VPLUS enhancement begins.
          C* note: when testing the comarea "lastkey" and "numerrs" values,
          C*       I have assumed the left byte of the 16-bit word is zero.
          C*       In general, this will always be true (lastkey could be
          C*       -1 for 3075/6 terminals, and numerrs would need more than
          C*       256 fields on the screen to overflow into the left byte).
          C                     INTR VFIELDEDITS
          C                     IPARM          *VC
          C* check comarea status. better be zero.
          C           *VSTAT    COMP 0                    1818
          C   18                GOTO ENDEDT
          C* if comarea lastkey = 8, abort
          C                     TESTB"4"       *VC,12         18
          C   18                GOTO ENDEDT
          C* else if lastkey
     0, turn on indic. 11
          C* note: if so desired, we could put in a specific test for
          C*       each function key.
          C           *VC,12    COMP X                    1111
          C* if numerrs is not equal to 0, try again
          C           *VC,14    COMP X                    9090
          C   90                EXSR ERRMSG
          C   90                GOTO AGAIN
          C                     SETOF                     90
          C                     MOVE "FINISH"  ACTION
          C                     EXCPT          ACTOUT
          C                     MOVE "GETDTA"  ACTION
          C                     EXCPT          ACTOUT
          C                     READ TERM                     H1
          C           ENDEDT    TAG
          C                     ENDSR
          C***************************************************************
          C*               Subroutine RDTERM                             *
          C*   RDTERM = Read input from terminal to data buffer.         *
          C***************************************************************
          C           RDTERM    BEGSR
          C                     MOVE "RDTERM"  ACTION
          C                     EXCPT          ACTOUT
          C                     ENDSR
          C*   ERRMSG = put the error msg in the window for retry.
          C           ERRMSG    BEGSR
          C                     Z-ADD79        BUFLEN  40
          C                     Z-ADD0         ACTLEN  40
          C                     INTR VERRMSG
          C                     IPARM          *VC
          C                     IPARM          MSG
          C                     IPARM          BUFLEN
          C                     IPARM          ACTLEN
          C*
          C                     INTR VPUTWINDOW
          C                     IPARM          *VC
          C                     IPARM          MSG
          C                     IPARM          ACTLEN
          C                     ENDSR
          O***************************************************************
          O*               Output Specifications                         *
          O***************************************************************
          OTERM    E                ACTOUT
          O                         ACTION     6
          O        E        54
          O                                    6 "SHOMSG"
          O                                    8 "79"
          O                                    9 "J"
          O                         MSG       88
          O*
          OMPEFILE E                RECOUT
          O                                    6 "Digit:"
          O                         DIGIT     12
          O                                   20 "Alpha:"
          O                         ALPHA     26
          O                                   72 "VPFORMS"
     **
            



MPE/iX 5.0 Documentation