[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | FOCUS, from INFORMATION BUILDERS |
|
Moderator: | ZAYIUS::BROUILLETTE |
|
Created: | Thu Feb 19 1987 |
Last Modified: | Mon May 05 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 615 |
Total number of notes: | 1779 |
231.0. "Need help using LIB$ functions in FOCUS!" by WLDWST::RPTTEST () Thu Jun 29 1989 14:29
Help!!! I am having problems trying to call a RTL procedure from
a FOCUS callable routine !
I have written two routines, debugged and linked them into FOCUS.
Both routines use the same parameters, (pass a string in, get a string
out).
The first one takes a Proccess name from our production system
and turns it into a "Processing Area" identifier and makes my reports
more organized. It works great. I have used it for 6 months without any
problems.
The second function passes in a string to search for a CLI symbol using
the Run-Time Library function "LIB$GET_SYMBOL", and passes the
resulting string back to FOCUS. When I ran it from a program, it worked
fine. Without any modification, (except to turn it into an object
module), running it from FOCUS does not pass anything back.
I *know* my function is correct because I have not changed anything in
it from it's program version. I *know* the parameters are being passed
correctly because it works with the first function. It acts like it is
linking but not running the library function. I know the symbol I am
trying to access exists especially because I add a VMS ... statement to
assign it just before I call my procedure.
Any Idea on what is going on ?
Scott Stephens
Digital - UCF - Cupertino, CA
Production Control
Below is some of the code I am writing (PASCAL!)
[global] module area;
type
string10 = packed array [1..10] of char;
string11 = packed array [1..11] of char;
(* A matching function which searches for leading sub-strings *)
[global] function starts( in_string : packed array [lo..hi:integer] of char;
test_string : varying [len] of char )
: boolean;
var
i,j,string_end : integer;
starting : boolean;
begin
string_end := length( test_string );
if string_end > len then string_end := hi;
starting := true; i := lo; j := 1;
while starting and (i <= string_end) do begin
if in_string[i] <> test_string[j] then starting := false;
i := i + 1; j := j + 1;
end;
starts := starting;
end; (* function starts *)
(*************** this procedure works *****************)
[global] procedure area(proid : string11;
var area : string10);
const
ERROR_AREA = 'XXX ';
begin
if proid = '' then area := ERROR_AREA else
if starts(proid, 'P101') then area := 'AREA_1' else
if starts(proid, 'P102') then area := 'AREA_2' else
if starts(proid, 'P103') then area := 'AREA_3' else
.... ......
area := ERROR_AREA;
end; (* procedure area *)
end.
[global] module getsym;
type
$UWORD = [WORD] 0..65535;
string = packed array [1..32] of char;
[ASYNCHRONOUS] FUNCTION lib$get_symbol (
symbol : [CLASS_S] PACKED ARRAY [$l1..$u1:INTEGER] OF CHAR;
VAR resultant_string : [CLASS_S,VOLATILE]
PACKED ARRAY [$l2..$u2:INTEGER] OF CHAR;
VAR resultant_length : [VOLATILE] $UWORD := %IMMED 0;
VAR table_type_indicator : [VOLATILE] INTEGER := %IMMED 0
) : UNSIGNED; EXTERNAL;
(******************** And this function fails **********************)
[global] procedure getsym( sym_name : string;
var sym_value : string);
begin
lib$get_symbol(sym_name,sym_value);
end;
end.
(*************** here is the GETSYM.FEX procedure that calls it ************)
VMS MY_DATE == "15-APR-1989 00:00:00.00"
-SET &AREA = AREA('P101','A10');
-SET &MY_DATE = GETSYM('MY_DATE','A23');
-TYPE &AREA
-TYPE &MY_DATE
-EXIT
(************** My output is .... **********************************)
>>EX GETSYM
> AREA_1
>>
T.R | Title | User | Personal Name | Date | Lines |
---|
231.1 | The problem is symbol definition... | TIGEMS::VOSS | | Mon Nov 13 1989 16:31 | 8 |
| The initial problem is in your VMS statement that assigns the symbol!
In FOCUS each and every VMS command creates a sub-process that lasts
only as long as the command and then goes away. So any symbol or
logical defined (w/o /JOB) will not exist for a parent-process.
Before getting into FOCUS to run your test, define your symbol,
globally, and then do VMS SHO SYM test-symbol right before you try your
sub-routine.
|
231.2 | and then symbol translation... | TUNER::COPPERSMITH | SYSTEM-W-RELFLT, reality fault | Wed Nov 29 1989 12:30 | 2 |
| Also specify in lib$get_symbol invocation that you intend to read
a global symbol.
|