HP RPG/iX Reference Manual Software Update Notice 900 Series HP 3000 Computers ABCDE HP Part No. 30318-90016 Printed in U.S.A.
NOTICE The information contained in this document is subject to change without notice. HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Hewlett-Packard shall not be liable for errors contained herein or for incidental or consequential damages in connection with the furnishing, performance or use of this material.
Printing History New editions are complete revisions of the manual. Update packages, which are issued between editions, contain additional and replacement pages to be merged into the manual by the customer. The dates on the title page change only when a new edition or a new update is published. No information is incorporated into a reprinting unless it appears as a prior update; the edition does not change when an update is incorporated.
Preface This update notice contains new information that should be added to the HP RPG/iX Reference Manual . Place the new pages included in this update at the end of Chapter 10 in your manual.
10a The RPG Interface to VPLUS VPLUS Communication Area Access New COMAREA Enhancement A new enhancement is now available for VPLUS application users, with RPG/iX version A.00.14 and later. This enhancement now allows read/write access to the VPLUS Communication Area (COMAREA). In the past this area was managed only by RPG, consistent with the philosophy of making all lower level I/O transparent to the user.
$CONTROL VPLUSCOM When the RPG/iX compiler detects the statement $CONTROL VPLUSCOM it sets a ag used to control certain items, both at compile time and at run time. It rst creates two new reserved-word variables, *VC and *VSTAT. *VC is declared to be a 200 character alpha-numeric array of 1 character per element. Do NOT enter a File Extension Speci cation for this variable. *VSTAT is declared to be a 6 digit numeric variable with 0 decimal places.
If HP releases a new intrinsic beginning with 'V', and you use it in your VPLUS application, *VSTAT would still be updated from the status word in the COMAREA, but it would be meaningless for the new call (unless,of course, it is a new VPLUS intrinsic). Due to the philosophy of managing lower-level I/O for the user, RPG/iX takes care of calling VOPENTERM and VCLOSETERM. Since these intrinsics also communicate with the terminal, it is possible they can also fail, with the resultant abort.
CORERR SHODTA PRINT CLRMSG CHMODE BLMODE 10a-4 Calls VSETERROR, VSHOWFORM, and VREADFIELDS. If VSETERROR fails, it will put an error message in the window and continue with VSHOWFORM. On completion of either VSHOWFORM or VREADFIELDS, the COMAREA status word is copied to *VSTAT. If there is no failure, the nal *VSTAT value is from VREAD-FIELDS. If either fails, an appropriate error message is placed in the window, and control returns to the user with no abort.
Actions Not Modified The actions that have not been modi ed 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 bu er. PUTMSG Calls VPUTWINDOW. If the output bu er column 7 is not blank, the COMAREA item WINDOWENH is modi ed. BADFLD Calls VSETERROR. May modify COMAREA item WINDOWENH depending on the value in the output bu er column 14.
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.
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 ve 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 C C C C C C N91 C C C C C C C C C C C C C C C C OTERMINALE O Update 1, 3/95 AGAIN *VSTAT X AOK ABORT 80 . .
Example 4 As another example, suppose you want to do your own batch le 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 C 91 EXSR WRBBAD . .
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.
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.
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.
** 10a-12 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.