[Info-vax] VMS Software Q1 '23 Update
Arne Vajhøj
arne at vajhoej.dk
Wed Jan 25 21:28:47 EST 2023
On 1/25/2023 9:24 PM, Arne Vajhøj wrote:
> On 1/25/2023 8:36 PM, Dave Froble wrote:
>> Perhaps some would not want variants, but I for one have used them
>> many times.
>>
>> Map (D) Long D1%
>> Map (D) String D1$=4
>>
>> Now in a MAP statement, whiich is rather similar to a COMMON block,
>> multiple definitions of the MAP statement allows for a similar
>> redefinition of the same memory. In the above, a longword value is
>> stored in 4 bytes of memory. The redefinition of the MAP statement
>> allows the same memory to be labeled as a string or a longword.
>>
>> It's been useful to me in the past.
>
> I am not arguing against this.
>
> But in Fortran this should not be done using common blocks but
> via equivalence.
>
> integer*4 iv
> character*4 sv
> equivalence (iv,sv)
>
> It has local scope and is readable.
>
> And if necessary it can be combined with a common block.
I am in the lucky situation to have an example.
https://www.vajhoej.dk/arne/articles/vmsipc.html#wrtshrimg_link
Fortran code:
byte mem(memsiz)
common /msgpsect/mem
character*100 msg(maxmsgs)
equivalence (mem,msg)
Basic code:
map (msgpsect) byte mem(memsiz1)
map (msgpsect) string msg(maxmsgs1) = maxmsgsiz
Arne
More information about the Info-vax
mailing list