Pascal accessing shared image data


Topic author
garyrevell
Active Contributor
Posts: 30
Joined: Thu Nov 19, 2020 7:15 am
Reputation: 0
Location: Basingstoke, UK
Status: Offline
Contact:

Pascal accessing shared image data

Post by garyrevell » Thu Jul 22, 2021 11:01 am

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


jreagan
VSI Expert
Member
Posts: 6
Joined: Tue Dec 01, 2020 8:40 am
Reputation: 0
Status: Offline

Re: Pascal accessing shared image data

Post by jreagan » Thu Jul 22, 2021 4:42 pm

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.)


Topic author
garyrevell
Active Contributor
Posts: 30
Joined: Thu Nov 19, 2020 7:15 am
Reputation: 0
Location: Basingstoke, UK
Status: Offline
Contact:

Re: Pascal accessing shared image data

Post by garyrevell » Fri Jul 23, 2021 4:05 am

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

User avatar

martinv
Active Contributor
Posts: 46
Joined: Fri Jun 14, 2019 11:05 pm
Reputation: 0
Location: Goslar, Germany
Status: Offline
Contact:

Re: Pascal accessing shared image data

Post by martinv » Fri Jul 23, 2021 6:09 am

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

Code: Select all

$ LINK example.obj, sys$input/OPTION
  $1$DGA100:<XXXXYYYY.0NN.SYSLIB>TRM_DATA.EXE /SHAREABLE
$
With that, your example program should be able to address the variable Terminals from TRM_DATA.EXE.
Never underestimate the power of human stupidity.
(Lazarus Long, by courtesy of Robert A. Heinlein)


jreagan
VSI Expert
Member
Posts: 6
Joined: Tue Dec 01, 2020 8:40 am
Reputation: 0
Status: Offline

Re: Pascal accessing shared image data

Post by jreagan » Fri Jul 23, 2021 8:49 am

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?

User avatar

arne_v
Valued Contributor
Posts: 53
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: Pascal accessing shared image data

Post by arne_v » Fri Jul 23, 2021 8:44 pm

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:

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
Arne
arne@vajhoej.dk
VMS user since 1986


Topic author
garyrevell
Active Contributor
Posts: 30
Joined: Thu Nov 19, 2020 7:15 am
Reputation: 0
Location: Basingstoke, UK
Status: Offline
Contact:

Re: Pascal accessing shared image data

Post by garyrevell » Thu Jul 29, 2021 10:31 am

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 ;)

User avatar

arne_v
Valued Contributor
Posts: 53
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Offline
Contact:

Re: Pascal accessing shared image data

Post by arne_v » Thu Jul 29, 2021 10:45 am

And more long term then I would recommend moving such data to a more general accessible storage.

Like a SQLite database.
Arne
arne@vajhoej.dk
VMS user since 1986


xanaphia
God
Posts: 46002
Joined: Sun Nov 12, 2023 6:17 am
Reputation: 0
Status: Online

Re: Pascal accessing shared image data

Post by xanaphia » Mon Nov 13, 2023 1:38 am



xanaphia
God
Posts: 46002
Joined: Sun Nov 12, 2023 6:17 am
Reputation: 0
Status: Online

Re: Pascal accessing shared image data

Post by xanaphia » Fri Dec 01, 2023 10:04 pm

audiobookkeeper.rucottagenet.rueyesvision.rueyesvisions.comfactoringfee.rufilmzones.rugadwall.rugaffertape.rugageboard.rugagrule.rugallduct.rugalvanometric.rugangforeman.rugangwayplatform.rugarbagechute.rugardeningleave.rugascautery.rugashbucket.rugasreturn.rugatedsweep.rugaugemodel.rugaussianfilter.rugearpitchdiameter.ru
geartreating.rugeneralizedanalysis.rugeneralprovisions.rugeophysicalprobe.rugeriatricnurse.rugetintoaflap.rugetthebounce.ruhabeascorpus.ruhabituate.ruhackedbolt.ruhackworker.ruhadronicannihilation.ruhaemagglutinin.ruhailsquall.ruhairysphere.ruhalforderfringe.ruhalfsiblings.ruhallofresidence.ruhaltstate.ruhandcoding.ruhandportedhead.ruhandradar.ruhandsfreetelephone.ru
hangonpart.ruhaphazardwinding.ruhardalloyteeth.ruhardasiron.ruhardenedconcrete.ruharmonicinteraction.ruhartlaubgoose.ruhatchholddown.ruhaveafinetime.ruhazardousatmosphere.ruheadregulator.ruheartofgold.ruheatageingresistance.ruheatinggas.ruheavydutymetalcutting.rujacketedwall.rujapanesecedar.rujibtypecrane.rujobabandonment.rujobstress.rujogformation.rujointcapsule.rujointsealingmaterial.ru
journallubricator.rujuicecatcher.rujunctionofchannels.rujusticiablehomicide.rujuxtapositiontwin.rukaposidisease.rukeepagoodoffing.rukeepsmthinhand.rukentishglory.rukerbweight.rukerrrotation.rukeymanassurance.rukeyserum.rukickplate.rukillthefattedcalf.rukilowattsecond.rukingweakfish.rukinozones.rukleinbottle.rukneejoint.ruknifesethouse.ruknockonatom.ruknowledgestate.ru
kondoferromagnet.rulabeledgraph.rulaborracket.rulabourearnings.rulabourleasing.rulaburnumtree.rulacingcourse.rulacrimalpoint.rulactogenicfactor.rulacunarycoefficient.ruladletreatediron.rulaggingload.rulaissezaller.rulambdatransition.rulaminatedmaterial.rulammasshoot.rulamphouse.rulancecorporal.rulancingdie.rulandingdoor.rulandmarksensor.rulandreform.rulanduseratio.ru
languagelaboratory.rulargeheart.rulasercalibration.rulaserlens.rulaserpulse.rulaterevent.rulatrinesergeant.rulayabout.ruleadcoating.ruleadingfirm.rulearningcurve.ruleaveword.rumachinesensible.rumagneticequator.rumagnetotelluricfield.rumailinghouse.rumajorconcern.rumammasdarling.rumanagerialstaff.rumanipulatinghand.rumanualchoke.rumedinfobooks.rump3lists.ru
nameresolution.runaphtheneseries.runarrowmouthed.runationalcensus.runaturalfunctor.runavelseed.runeatplaster.runecroticcaries.runegativefibration.runeighbouringrights.ruobjectmodule.ruobservationballoon.ruobstructivepatent.ruoceanmining.ruoctupolephonon.ruofflinesystem.ruoffsetholder.ruolibanumresinoid.ruonesticket.rupackedspheres.rupagingterminal.rupalatinebones.rupalmberry.ru
papercoating.ruparaconvexgroup.ruparasolmonoplane.ruparkingbrake.rupartfamily.rupartialmajorant.ruquadrupleworm.ruqualitybooster.ruquasimoney.ruquenchedspark.ruquodrecuperet.rurabbetledge.ruradialchaser.ruradiationestimator.rurailwaybridge.rurandomcoloration.rurapidgrowth.rurattlesnakemaster.rureachthroughregion.rureadingmagnifier.rurearchain.rurecessioncone.rurecordedassignment.ru
rectifiersubstation.ruredemptionvalue.rureducingflange.rureferenceantigen.ruregeneratedprotein.rureinvestmentplan.rusafedrilling.rusagprofile.rusalestypelease.rusamplinginterval.rusatellitehydrology.ruscarcecommodity.ruscrapermat.ruscrewingunit.ruseawaterpump.rusecondaryblock.rusecularclergy.ruseismicefficiency.ruselectivediffuser.rusemiasphalticflux.rusemifinishmachining.ruspicetrade.ruspysale.ru
stungun.rutacticaldiameter.rutailstockcenter.rutamecurve.rutapecorrection.rutappingchuck.rutaskreasoning.rutechnicalgrade.rutelangiectaticlipoma.rutelescopicdamper.rutemperateclimate.rutemperedmeasure.rutenementbuilding.rutuchkasultramaficrock.ruultraviolettesting.ru

Post Reply