Stan Sieler wrote:
> 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
>
I am a Cobol'er but not at the level of Walter Murray & Brain Donaldson
are; these guys have gotten Cobol to do things that it just wasn't
design to do. Walter helped me out years ago getting Cobol to process
HP-Real data, Brain helped me to get cobol to call some AIF routines, I
must have accidentally close file #0 at one point because I've
successfully open it before. Actually this may help me with my current
challenge, trying to tell VSHOWFORM to write to a file other than a
terminal. I've tried saving FILEN of the comarea, opening a disc file
and moving that fnum to filen, no go. Is VSHOWFORM hard coded to write
to #0 or #1? If so, then if I close (FCLOSE(0,0,0)) file #0 or #1, and
then open a disc file, and call VSHOWFORM, umm?
But I did stay at a Holiday Inn Express last night ;-)
--
Michael Anderson,
J3k Solutions
Sr.Systems Programmer/Analyst
832.515.3868
* To join/leave the list, search archives, change list settings, *
* etc., please visit http://raven.utc.edu/archives/hp3000-l.html *
|