HP3000-L Archives

June 2008, Week 4

HP3000-L@RAVEN.UTC.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Stan Sieler <[log in to unmask]>
Reply To:
Stan Sieler <[log in to unmask]>
Date:
Mon, 23 Jun 2008 15:59:01 -0700
Content-Type:
text/plain
Parts/Attachments:
text/plain (85 lines)
Re:

(more on the IMAGE root file fopen problem)

> >>      CALL INTRINSIC "GETPRIVMODE"
> >>      MOVE ZEROES TO WS-DB-FILE-NUM
> >>      MOVE WS-DBN-DATA-BASE-NAME
> >>        TO WS-HOLD-FILE-NAME
> >>      CALL INTRINSIC "FOPEN" USING WS-HOLD-FILE-NAME
> >>                                   \%1\ \%2360\
> >>                                   WS-DB-REC-SIZE
> >>                                   \\ \\ \\ \\
> >>                                   \\ \\ \\ \\
> >>                                   WS-FILE-CODE
> >>                            GIVING WS-DB-FILE-NUM
> >>      IF (C-C <> ZEROES) OR
...
> >>          GO TO A100-EXIT

You're still in privmode when you get to A100-EXIT 
... an excellent example of why the getprivmode/fopen/getusermode 
technique was deprecated about 20 years ago.

I've posted about this in the past, but I don't know how to COBOL-ize
it (or if that's even possible :) ... but here's a rough Pascal
example (SPLash! can do something similar):

      function my_priv_fopen (...various parameters...)
            : shortint $exec_privilege 2$;

          begin

          my_priv_fopen := FOPEN (...various parameters...);

          end;
          
this removes the need for GETPRIVMODE and GETUSERMODE entirely,
and is therefore quicker and safer.  The program still needs
to be prepped with CAP=PM (or "my_priv_fopen" put into an XL in
a group with PM).

Wait...a google search shows I posted about this at least back in 2003,
in response to a question by one "Brian Donaldson".

> >>      MOVE "ENA FETIDB FOR DEADLOCKDETECT"
> >>        TO  DBSCHEMA-RECORD
> >>      WRITE DBSCHEMA-RECORD
> >>      IF WS-STATUS <> ZEROES THEN
> >>         MOVE 326 TO WS-MSGNUM
> >>         MOVE "Y" TO WS-STOP-FLAG
> >>         IF WS-STATUS (1:1) = "9" THEN
> >>            CALL "Translate_File_Status" USING WS-STATUS
> >>                                               WS-ERROR-CODE
> >>         ELSE
> >>             MOVE WS-STATUS TO WS-ERROR-CODE
> >>         END-IF
> >>         GO TO A120-EXIT
> >>      END-IF

I'm not a COBOLer ... is it not possible to do something like:

     CALL "append_a_line" using "ENA FETIDB FOR DEADLOCKDETECT"
     CALL "append_a_line" using "EXIT"

to simplify the code and make it more robust/maintainable?

> >>
> >> CANNOT FOPEN THE ROOT FILE=>FETIDB.PUB.SYS
> >> Error Code = +0000
> >> File Number = +0000
> >> File Code on FOPEN = -0400
> >> Rec Size = -0256

I'd add:  CALL INTRINSIC PRINTFILEINFO USING WS-DB-FILE-NUM
(or however that's done in COBOL :)

Stan
-- 
Stan Sieler
[log in to unmask]
www.allegro.com/sieler/wanted/index.html 

* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *

ATOM RSS1 RSS2