From:	CSBVAX::MRGATE!U0012%DGOGWDG5.BITNET@CUNYVM.CUNY.EDU@SMTP 17-MAY-1988 23:08
To:	ARISIA::EVERHART
Subj:	translating status codes to text


Received: from CUNYVM.CUNY.EDU by KL.SRI.COM with TCP; Tue 17 May 88 00:45:16-PDT
Received: from DGOGWDG5.BITNET by CUNYVM.CUNY.EDU (IBM VM SMTP R1.1) with BSMTP id 0827; Tue, 17 May 88 03:44:47 EDT
Date:    Tue, 17-MAY-1988 09:42  +0200
From:    "GWDGV1::MOELLER"  <U0012%DGOGWDG5.BITNET@CUNYVM.CUNY.EDU>
To:      info-vax@kl.sri.COM
Subject: translating status codes to text

> (Peter Scott <PJS@NAIF.JPL.NASA.GOV> asked
> how to find out what a facility-specific status code could be
> translated into text.

In general an image may exit with an image-specific status code
which is not in any message library, so you have to know
the image that produced the status.
given that you know the image, here's a (e.g.FORTRAN-callable)
MACRO subroutine to reproduce that image's exit,
so the the appropriate message will be output again.

N.B. make sure the status input to the routine has the
"don't signal"-bit (hex 10000000) clear, otherwise nothing will be output.

---------- cut here --------
        .title  xfmsg           use $IMGACT to issue exit message
;
;       this subroutine copies part of itself upon the stack,
;       loads an image and then *exits* with status
;
;       call:
;               subroutine xfmsg(image,status)
;               character*(*) image     ! default is 'SYS$SYSTEM:.EXE'
;               integer status          ! by reference
;               * does not return *
;
stackcode:      ;entered here via JUMP
;
        movab   handl,(fp)
;
        subl    #512,sp
        movl    sp,r6           ;r6 -> hdrbuf
        pushab  dflnam1
        pushl   #dflnam1l
        $imgact_s       name=(r7),dflnam=-8(r6),hdrbuf=(r6)
        blbc    r0,13$
        $imgfix_s
        blbc    r0,13$
;
        movl    r8,r0
13$:
        $exit_s r0
;
handl:  .word   ^m<>            ;brute force catch-all handler
        moval   @1*4(ap),r1
        blbs    4(r1),9$
        $exit_s 4(r1)
9$:     movl    s^#ss$_continue,r0
        ret
;
dflnam1:        .ascii  "SYS$SYSTEM:.EXE"
dflnam1l=.-dflnam1
;
stackcodel=.-stackcode  ; end of stack code
;
        .ENTRY  XFMSG,^m<r2,r3,r4,r5,r6,r7,r8>
;
        movaq   @1*4(ap),r7             ;-> image name dsc.
        movl    @2*4(ap),r8             ;status
;
        subl    #stackcodel,sp
        movc3   #stackcodel,stackcode,(sp)
;
        jmp     (sp)
;
        .end
---------- cut here --------

P.S. I sincerely hope no-one still uses VMS V4.0 or V4.1 ...

Wolfgang J. Moeller, GWDG, D-3400 Goettingen, F.R.Germany | Disclaimer ...
Bitnet/Earn: U0012@DGOGWDG5         Phone: +49 551 201516 | No claim intended
