[Info-vax] COBOL example $MGBLSC
Chris Townley
news at cct-net.co.uk
Fri Sep 8 18:59:39 EDT 2023
On 08/09/2023 23:50, bill wrote:
> On 9/8/2023 4:40 PM, Arne Vajhøj wrote:
>> On 9/8/2023 1:55 PM, bill wrote:
>>> On 9/8/2023 1:13 PM, Arne Vajhøj wrote:
>>>> On 9/8/2023 12:45 PM, Brian Schenkenberger wrote:
>>>>> I have the SYS$MGBLSC working... at least, in the debugger. I
>>>>> defined a test global section with two longwords.
>>>>>
>>>>> 1,-1
>>>>> 2,-2
>>>>> 3,-3
>>>>> etc.,-etc.
>>>>> 0,0
>>>>>
>>>>> I have the following for the global section's element definition:
>>>>>
>>>>> LINKAGE SECTION.
>>>>>
>>>>> 01 GLOBAL-SECTION.
>>>>> 02 ELEMENT OCCURS 2000 TIMES.
>>>>> 03 A PIC S9(9) COMP.
>>>>> 03 B PIC S9(9) COMP.
>>>>>
>>>>> and the procedure...
>>>>>
>>>>> PROCEDURE DIVISION USING GLOBAL_SECTION.
>>>>> PARAGRAPH-MAIN.
>>>>> PERFORM PARAGRAPH-ENTER THRU PARAGRAPH-EXIT
>>>>> VARYING I FROM 1 BY 1 UNTIL A(I) = 0 AND B(I) = 0.
>>>>> PARAGRAPH-ENTER.
>>>>> DISPLAY "First[" I "]: " A(I) " Second[" I "]: " B(I).
>>>>> PARAGRAPH-EXIT.
>>>>> EXIT.
>>>>> END PROGRAM GBLSEC.
>>>>>
>>>>> In the debugger, A(I) and B(I) show me the values but DISPLAY pukes
>>>>> on them. It'd be great too if there was a way to DISPLAY them in
>>>>> HEX but just getting it to DISPLAY without regurgitaing garbage
>>>>> would be great.
>>>>
>>>> Add a couple of temporary variables:
>>>>
>>>> WORKING-STORAGE SECTION.
>>>> 01 AI PIC 9(4) DISPLAY.
>>>> 01 BI PIC 9(4) DISPLAY.
>>>>
>>>> and do:
>>>>
>>>> MOVE A(I) TO AI
>>>> MOVE B(I) TO BI
>>>> DISPLAY "First[" I "]: " AI " Second[" I "]: " BI.
>>>>
>>>> If anyone that actually knows Cobol has a better solution then
>>>> I am also interested!
>>>
>>> I really don't have that much experience with VMS COBOL and have no idea
>>> what $MGBLSC means,
>>
>> SYS$MGLBSC is the VMS system service to map a global section.
>>
>>> but, if it is merely a display problem how about a
>>> REDEFINES from COMP to DISPLAY instead of another variable and the MOVE?
>>
>> How would that look like?
>
> Can you point me at a copy of the VMS COBOL Reference Manual?
> This is something VMS specific. I tried a couple sites. One
> of them returned XML errors and sector7 pointed me at localhost.
> If I can grab a quick look at the manual I can probably provide
> a fairly clean way to do it. I may even try to figure out how
> to get to EISNER after the port change and then I will actually
> test what I write.
>
Try https://docs.vmssoftware.com/vsi-cobol-for-openvms-reference-guide
There is also a User guide
--
Chris
More information about the Info-vax
mailing list