HP30003k Associates LogoHP3000/HP 3000 FAQ

Last Updated: Thursday, February 01, 2007 02:38 PM

HP3000 FAQ
MPE/V

HPe3000 FAQ
MPE/XL

HP 3000 FAQ
MPE/iX


Miscellaneous HP3000 Programming Bugs and Features

6.9.   Miscellaneous programming bugs/features


6.9.1. Loader messages in $STDLIST

A :FILE LOADLIST=$NULL can re-route all loader error messages to $NULL, since they seem to ignore HPMSGFENCE settings and other controls.


6.9.2. How to get arrow-keys to work in vi/etc.

How can you get the #%@$# cursor keys to work? With TERM='hp2392a' they don't. vi is just too weird without 'em :-)

LB
Posix vi looks for an EXRC environment variable, which by default is "./.exrc". Put mappings like the ones shown below in that file to map your arrow keys to the proper vi key. Note -- use a real escape character where you see "^[".

   map ^[A k
   map ^[B j
   map ^[C l
   map ^[D h

6.9.3. How to call "Pause" in COBOL

CL
I'm assuming you're on an XL system. Just call the COMMAND Intrinsic and pass it the MPE command PAUSE.

RAT
Yes!

From my stint at the HP Response Center (greetings to my former fellows!), I've got several sample COBOL routines to do this. Here's my favorite one, which uses HPEXTIN to convert a string to a REAL value:

(much COBOLeez omitted)
 WORKING-STORAGE SECTION.

 01 string-num pic x(5) value "00005".
 01 string-len pic s9(4) comp value 5.
 01 decplaces  pic s9(4) comp value 0.
 01 datatype   pic s9(4) comp value 1.
 01 scale      pic s9(4) comp value 0.
 01 delims     pic s9(4) comp value 0.
 01 pause-value pic x(4)      value "xxxx".
 01 error1     pic s9(4) comp value 0.
 01 d-error    pic 9(5) value 0.


(somewhere in PROCEDURE DIVISION land )

     CALL INTRINSIC "HPEXTIN" USING string-num, string-len,
          decplaces, datatype, scale, delims, pause-value, error1.

     if cc not equal zero
          display "Error on HPEXTIN call"
          move error1 to d-error
          display "Error = " d-error
          goback.

     CALL INTRINSIC "PAUSE" USING pause-value.

To change the value, simply change the text in "string-num" to the number of seconds.

There are several examples of this on HP SupportLine as well.

TBS
Try this (from my infamous 3-ring binder:

{ Cute trick for PAUSE intrinsic:
{   01  xx.
{     03  high-word s9(4) comp value %040100.
{     03  low-word  s9(4) comp zero.
{  *  Evaluates to x'40400000' or 1 second, +1077936128.
{  *  For 5 seconds, +1083179008, x'40900000'.

6.9.4. How to Fopen a terminal for read/write operations

RAT
I've had good luck with:
:FILE term,NEW;DEV=nnn;ACC=INOUT

This allows both read and write to the ldev (if it's AVAILable) and doesn't generate a REPLY request on the console.

Also be sure to check the Condition Code after the FOPEN to ensure it actually worked. Call PRINTFILEINFO if it's not CCE and that should give you a good FSERROR number to lookup.


6.9.5. How can I programatically tell what MPE version I'm on?

JV
The variable HPCWD exists on 4.5 and later

The command NEWLINK exists on 5.0 and later (there must be a better way...)

listfile ;seleq=[object=hfsdir] 'hfsdir' may not be supported on 4.5, definitely isn't on 4.0.

NOTE:

On the Express 3 release of 5.0 (June?) there are 2 new CI variables: HPOSVERSION and HPRELEASE version. These contain the os and release ids seen in the :SHOWME banner. Eg.

  :showvar hp@version
  HPOSVERSION = B.79.06   (can't be changed)
  HPRELVERSION = B.79.05  (can't be changed)
  HPVERSION = B.79.05  <== this can be changed in sysgen.

6.9.6. Purging a large file

GC
When the MPE/XL machines came out, HP changed the :PURGE command to first "wipe out" the file, effectively "shredding" the contents so that even low-level tools could not recreate its contents. (I believe this was in response to a DoD requirement.) For large files, this can take a long time. However, by first removing write access to the file, the :PURGE command cannot write to the file, but the file is deleted anyway! The following command file shows how this works.

   PARM filename="?"
   if  "!filename" = "?"
      echo Function: Purge a large file quickly
      echo Syntax  : PURGEQ filename
      echo Parm    : filename  -  the name of the file to be purged
      echo Example : PURGEQ BIGFILE
      echo
      return
   endif
   FILE X = !filename, OLD; ACC=IN
   if finfo( "*X", "exists" )
      PURGE *X
   else
      PURGE !filename
   endif
   RESET X

The ",OLD" designation is used on the :FILE equation so that "finfo" will not acknowledge a temporary file of the same name. The "ACC=IN" is what removes write access.

If the file does not exist, we want :PURGE to return the appropriate error message without reference to file "X".

No doubt other enhancements are possible, but this gets the idea across.

Incidentally, temporary files are not affected by the "long purge."


6.9.7. Purging a 'priv' file

PHC

1. Use listf -3 on the file to find out the actual value of the 'PRIV'
   file code.
        :LISTF I0038,-3
        ********************
        FILE: I0038.DATA....

        FILE CODE : -400                FOPTIONS: BINARY,FIXED....
        BLK FACTOR: 1                   CREATOR : MGR
        ...

        VOLCLASS  : MPEXL_SYSTEM_VOLUME_SET:DISC

2. Issue a file equation such as:
        FILE A=I0038;DEL

3. Using the following DSCOPY syntax (an error will occur but the file
        will be deleted):

        DSCOPY *A;$NULL;FCODE=-400

        :DSCOPY *A;$NULL;FCODE=-400
          Source file: I0038.DATA.....
          Target file: $NULL
          UNABLE TO ACCESS TARGET FILE/DEVICE.  (NS/NFTERR 48)

          END OF SUBSYSTEM
        :LF I0@,2
         LISTF I0@,2
         NO FILES FOUND IN FILE-SET (CIWARN 431)

GAH
Another suggestion: The PURGEGROUP command will purge a group (as long as you have at least AM) even if it includes PRIV files. (of course, if you have other files that you *DON'T* want purged in that group, you'll have to copy them to a group temporarily).

GSA
Gilles Schipper (Gilles_Schipper@MAIL.MAGIC.CA) adds:

:FILE T=$NULL
:STORE privfilename;*t;SHOW;PURGE

This works on 5.0. For 4.0 or earlier, I believe you cannot use a NULL file equation for the tape. It should work if you use a real (or is it reel) tape.

In either case, you will need the appropriate capability to store PRIV files (i.e. OP or PM).

Alternatively, you can run FSCHECK.MPEXL.TELESUP and use the PURGEFILE command.

GS
for 4.0, simply add ;TRANSPORT to the :STORE command. CMSTORE has always supported storing to $NULL. It's just NMSTORE/TURBOSTORE that didn't support it until 5.0.

Of course if it is a big file, you probably have to wait a while as it writes all the data out to $NULL before purging your file.


6.9.8. How to tell if your session is a VT session from a batch job

JK
Want to know if you're a VT session initiated by a batch job's REMOTE HELLO? Well, HPINTERACTIVE is true (even if started by batch job), so try to set HPTYPEAHEAD true. If it fails, your origin is a batch job.


6.9.9. How to tell if your program is being run from a VT session

JK
Do a NSINFO of the $BACK environment.

If you get an error, you're not a VT session. If no error, you get back the name of the originating node (usually :-) ).

 


Back to FAQ Index Back to 3k Home Page
 
HP3000-L FAQ Collection (c) 3k Associates, Inc. 1996-2006