Pascal accessing shared image data
-
Topic author - Active Contributor
- Posts: 38
- Joined: Thu Nov 19, 2020 7:15 am
- Reputation: 0
- Location: Basingstoke, UK
- Status: Offline
- Contact:
Pascal accessing shared image data
Hi,
I've got a shared image that contains system wide terminal data, the image is installed as:
$1$DGA100:<XXXXYYYY.0NN.SYSLIB>.EXE List head adr/siz/ref = 9D862830/52/26
TRM_DATA;9 Open Hdr Shared Lnkbl Wrt
And there's a [COMMON] record structure variable which stores the data and is defined as:
Terminals : [Common] terminal_data_rec;
What I'd like to do is be able to access the Terminals data via another program, so I can print the data out. So I've written a small Pascal report program and declared the following VARs
VAR
Ghost : terminal_file := ZERO;
Terminals : [Common] terminal_data_rec;
myterm : integer;
However, when I look at the Terminals data from my reporting program the data is empty/binary zero. So looks like I need to map the data but I'm not sure how to? Is there a Pascal function/procedure or so I need to use a system service to map it from the TRM_DATA.EXE?
Thanks in advance.
Gary
I've got a shared image that contains system wide terminal data, the image is installed as:
$1$DGA100:<XXXXYYYY.0NN.SYSLIB>.EXE List head adr/siz/ref = 9D862830/52/26
TRM_DATA;9 Open Hdr Shared Lnkbl Wrt
And there's a [COMMON] record structure variable which stores the data and is defined as:
Terminals : [Common] terminal_data_rec;
What I'd like to do is be able to access the Terminals data via another program, so I can print the data out. So I've written a small Pascal report program and declared the following VARs
VAR
Ghost : terminal_file := ZERO;
Terminals : [Common] terminal_data_rec;
myterm : integer;
However, when I look at the Terminals data from my reporting program the data is empty/binary zero. So looks like I need to map the data but I'm not sure how to? Is there a Pascal function/procedure or so I need to use a system service to map it from the TRM_DATA.EXE?
Thanks in advance.
Gary
Re: Pascal accessing shared image data
Hi,
You'll have to call the $CRMPSC service yourself. Do you need help with an example? (I have lots of examples from over the years but not for this. I can whip up one tomorrow if nobody else jumps in first.)
You'll have to call the $CRMPSC service yourself. Do you need help with an example? (I have lots of examples from over the years but not for this. I can whip up one tomorrow if nobody else jumps in first.)
-
Topic author - Active Contributor
- Posts: 38
- Joined: Thu Nov 19, 2020 7:15 am
- Reputation: 0
- Location: Basingstoke, UK
- Status: Offline
- Contact:
Re: Pascal accessing shared image data
Hi,
Thanks very much for the offer, I'm not very familiar with VMS Pascal so an example would be very helpful.
Look forward to seeing how to do it!
Best regards
Gary
Thanks very much for the offer, I'm not very familiar with VMS Pascal so an example would be very helpful.
Look forward to seeing how to do it!
Best regards
Gary
-
- Master
- Posts: 111
- Joined: Fri Jun 14, 2019 11:05 pm
- Reputation: 0
- Location: Goslar, Germany
- Status: Offline
- Contact:
Re: Pascal accessing shared image data
IMHO, it should work without needing to use $CRMPSC. I'm assuming, of course, that Terminals has been defined as a universal symbol in TRM_DATA.EXE (which is done when linking it).
What you need to do is link the example program against the shareable image, like
With that, your example program should be able to address the variable Terminals from TRM_DATA.EXE.
What you need to do is link the example program against the shareable image, like
Code: Select all
$ LINK example.obj, sys$input/OPTION
$1$DGA100:<XXXXYYYY.0NN.SYSLIB>TRM_DATA.EXE /SHAREABLE
$
What's the new buzzword to make on-premises sound cool again? "Cloudless"!
Re: Pascal accessing shared image data
I didn't consider if that data had a universal symbol.
Do you know how that TRM_DATA.EXE is linked? How it is referenced from other applications?
Do you know how that TRM_DATA.EXE is linked? How it is referenced from other applications?
-
- Master
- Posts: 409
- Joined: Fri Apr 17, 2020 7:31 pm
- Reputation: 0
- Location: Rhode Island, USA
- Status: Offline
- Contact:
Re: Pascal accessing shared image data
I am not sure that I understand the problem completely.
And I have not worked with such writeable shareable images for 25 years.
But some random code and runs on VMS Alpha:
And I have not worked with such writeable shareable images for 25 years.
But some random code and runs on VMS Alpha:
Code: Select all
$ type data.for
BLOCK DATA demo
INTEGER*4 a(256)
COMMON /demodata/a
DATA a /256*0/
END
$ for data
$ link data/share + sys$input/opt
SYMBOL_VECTOR=(demodata=PSECT)
PSECT_ATTR=demodata,SHR
$
$ install
remove disk2:[arne]data.exe
add disk2:[arne]data.exe /share/write
exit
$ define/sys/exe/nolog datashr disk2:[arne]data.exe
Code: Select all
$ type upd1.for
PROGRAM upd1
INTEGER*4 a(256)
COMMON /demodata/a
WRITE(*,*) a(1)
a(1) = a(1) + 1
END
$ for upd1
$ link upd1 + sys$input/opt
PSECT_ATTR=demodata,SHR
datashr/SHARE
$
$ run upd1
0
$ run upd1
1
$ run upd1
2
$ type upd2.pas
program upd2(input, output);
var
a : [common(demodata)] array [1..256] of integer;
begin
writeln(a[1]);
a[1] := a[1] + 1;
end.
$ pas upd2
$ link upd2 + sys$input/opt
PSECT_ATTR=demodata,SHR
datashr/SHARE
$
$ run upd2
3
$ run upd2
4
$ run upd2
5
-
Topic author - Active Contributor
- Posts: 38
- Joined: Thu Nov 19, 2020 7:15 am
- Reputation: 0
- Location: Basingstoke, UK
- Status: Offline
- Contact:
Re: Pascal accessing shared image data
Thanks everyone for your input.
In the end I've decided to use a simpler method, I've written a simple Pascal function in the shared image that returns the value of the Terminals data structure, and the resulting data works fine for my needs.
Having played about with [COMMON] attribute etc it looks like the shared image is acting a bit like an object in OOP in that it has private data encapsulated in it and public interfaces to this, so I thought might as well use that approach
In the end I've decided to use a simpler method, I've written a simple Pascal function in the shared image that returns the value of the Terminals data structure, and the resulting data works fine for my needs.
Having played about with [COMMON] attribute etc it looks like the shared image is acting a bit like an object in OOP in that it has private data encapsulated in it and public interfaces to this, so I thought might as well use that approach
-
- Master
- Posts: 409
- Joined: Fri Apr 17, 2020 7:31 pm
- Reputation: 0
- Location: Rhode Island, USA
- Status: Offline
- Contact:
Re: Pascal accessing shared image data
And more long term then I would recommend moving such data to a more general accessible storage.
Like a SQLite database.
Like a SQLite database.