HP3000-L Archives

November 2003, Week 3

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:
Fri, 21 Nov 2003 12:35:50 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (88 lines)
Re:

> PROCEDURE get_js_data(var overall_status:status_type;
...
> begin
>    GETPRIVMODE;
...
>    AIFJSGET(overall_status,
>             item_num_array,
>             item_array,
>             item_status_array,jsnum,jskey,);
...
> GETUSERMODE;


My yearly advice to a new PM programmer :)  ...

You *never* want to call GETUSERMODE at the end of any procedure!

Why?

First, correctness: if the calling procedure was already in PM,
you've just screwed it by returing in usermode ... this could lead
to program aborts.

Second, performance: why spend the cycles in GETUSERMODE when
*simply returning* will return the PM/usermode to the mode it was
in when your procedure was called?

Also...the next piece of advice is:

   Try to avoid calling GETPRIVMODE at all!

Particularly for procedures that are of the form:

   procedure <....>;
   <...>
   begin
   getprivmode;
   ...
   getusermode;
   end

the following works very nicely, and provides better performance:

   procedure <....> $exec_privilege 2$;
   <...>
   begin
   ...
   end;

I.e., no GETPRIVMODE call, and no GETUSERMODE call.
(it also works for "function"s.)

If the code is linked into a program, the program must have PM cap
(just like if GETPRIVMODE was being used).

If the code is in an XL, the group the XL is in must have PM cap.

> How do I define this jsnum_type field in a COBOL program (which is the
> mainline calling this AIF procedure (PASCAL)) ??

Ah...COBOL.... I haven't a clue.

But, a workaround is to pass the JS number as text ("#J23" or "#S1234")
and have the Pascal routine convert it to jsnum_type.

Also, it's easier to read Pascal things like:

   if quiet_session then

than

   if quiet_session = true then

That's why we have booleans in Pascal.

Hope this helps,

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