[Info-vax] COBOL example $MGBLSC
bill
bill.gunshannon at gmail.com
Fri Sep 8 13:55:37 EDT 2023
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, but, if it is merely a display problem how about a
REDEFINES from COMP to DISPLAY instead of another variable and the MOVE?
Is this unique to x86-64 or could I play with the examples on EISNER?
bill
More information about the Info-vax
mailing list