Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Your code should be more efficient!


computers / comp.os.vms / Re: COBOL example $MGBLSC

SubjectAuthor
* COBOL example $MGBLSCBrian Schenkenberger
+- Re: COBOL example $MGBLSCabrsvc
+* Re: COBOL example $MGBLSCBrian Schenkenberger
|`* Re: COBOL example $MGBLSCArne Vajhøj
| +- Re: COBOL example $MGBLSCBrian Schenkenberger
| +* Re: COBOL example $MGBLSCBrian Schenkenberger
| |`* Re: COBOL example $MGBLSCArne Vajhøj
| | +* Re: COBOL example $MGBLSCJohn Reagan
| | |`* Re: COBOL example $MGBLSCBrian Schenkenberger
| | | +- Re: COBOL example $MGBLSCJohn Reagan
| | | `- Re: COBOL example $MGBLSCArne Vajhøj
| | `* Re: COBOL example $MGBLSCBrian Schenkenberger
| |  +* Re: COBOL example $MGBLSCArne Vajhøj
| |  |`* Re: COBOL example $MGBLSCbill
| |  | +- Re: COBOL example $MGBLSCDave Froble
| |  | `* Re: COBOL example $MGBLSCArne Vajhøj
| |  |  `* Re: COBOL example $MGBLSCbill
| |  |   `* Re: COBOL example $MGBLSCChris Townley
| |  |    +- Re: COBOL example $MGBLSCbill
| |  |    `* Re: COBOL example $MGBLSCbill
| |  |     +* Re: COBOL example $MGBLSCJan-Erik Söderholm
| |  |     |+* Re: COBOL example $MGBLSCDave Froble
| |  |     ||`* Re: COBOL example $MGBLSCJan-Erik Söderholm
| |  |     || `* Re: COBOL example $MGBLSCArne Vajhøj
| |  |     ||  `* Re: COBOL example $MGBLSCbill
| |  |     ||   `* Re: COBOL example $MGBLSCArne Vajhøj
| |  |     ||    +* Re: COBOL example $MGBLSCbill
| |  |     ||    |+* Re: COBOL example $MGBLSCChris Townley
| |  |     ||    ||`- Re: COBOL example $MGBLSCbill
| |  |     ||    |+* Re: COBOL example $MGBLSCArne Vajhøj
| |  |     ||    ||`* Re: COBOL example $MGBLSCbill
| |  |     ||    || `- Re: COBOL example $MGBLSCArne Vajhøj
| |  |     ||    |`* Re: COBOL example $MGBLSCJohnny Billquist
| |  |     ||    | `- Re: COBOL example $MGBLSCScott Dorsey
| |  |     ||    `- Re: COBOL example $MGBLSCScott Dorsey
| |  |     |`* Re: COBOL example $MGBLSCJohn Dallman
| |  |     | `- Re: COBOL example $MGBLSCbill
| |  |     `- Re: COBOL example $MGBLSCArne Vajhøj
| |  +- Re: COBOL example $MGBLSCHein RMS van den Heuvel
| |  `* Re: COBOL example $MGBLSCArne Vajhøj
| |   `* Re: COBOL example $MGBLSCArne Vajhøj
| |    `- Re: COBOL example $MGBLSCArne Vajhøj
| `- Re: COBOL example $MGBLSCArne Vajhøj
`* Re: COBOL example $MGBLSCSimon Clubley
 `- Re: COBOL example $MGBLSCBrian Schenkenberger

Pages:12
COBOL example $MGBLSC

<udcn5f$31542$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29709&group=comp.os.vms#29709

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mai...@SendSpamHere.ORG (Brian Schenkenberger)
Newsgroups: comp.os.vms
Subject: COBOL example $MGBLSC
Date: Thu, 7 Sep 2023 10:36:31 -0400
Organization: Tmesis Software
Lines: 15
Message-ID: <udcn5f$31542$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="36cba33aa45007410312978d251b7c7a";
logging-data="3183746"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VUciSNy7Q3jynUEOFEIjA"
User-Agent: Unison/2.2
Cancel-Lock: sha1:OimdYlwHlJGcmEooGZ2GhPi0rZI=
 by: Brian Schenkenberger - Thu, 7 Sep 2023 14:36 UTC

I need to tell a customer how to map, assuming this is even possible, a
global section into which I write data for them. They only do COBOL. :(
Is this possibe? How does one reference the data once mapped in the
expanded region? I've tried to make heads or tails of COBOL but I get
totally lost in the PICs.

If only somebody would do what Jim Duff did for calling system services
with C but using COBOL. So very few examples exist.

— VAXman (still on the outside trying to look into VMS x86)

Re: COBOL example $MGBLSC

<adfb3a66-5cfb-4726-b709-2db05bd251d6n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29710&group=comp.os.vms#29710

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:620a:1a25:b0:76d:7a99:9b33 with SMTP id bk37-20020a05620a1a2500b0076d7a999b33mr556457qkb.1.1694098423653;
Thu, 07 Sep 2023 07:53:43 -0700 (PDT)
X-Received: by 2002:a63:b745:0:b0:56f:e58d:8839 with SMTP id
w5-20020a63b745000000b0056fe58d8839mr4098567pgt.6.1694098423099; Thu, 07 Sep
2023 07:53:43 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Thu, 7 Sep 2023 07:53:42 -0700 (PDT)
In-Reply-To: <udcn5f$31542$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:4040:5ed8:3d00:383e:4d23:54c3:5933;
posting-account=Ysq9BAoAAACGX1EcMMPkdNg4YcTg0TxG
NNTP-Posting-Host: 2600:4040:5ed8:3d00:383e:4d23:54c3:5933
References: <udcn5f$31542$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <adfb3a66-5cfb-4726-b709-2db05bd251d6n@googlegroups.com>
Subject: Re: COBOL example $MGBLSC
From: dansabrs...@yahoo.com (abrsvc)
Injection-Date: Thu, 07 Sep 2023 14:53:43 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2020
 by: abrsvc - Thu, 7 Sep 2023 14:53 UTC

On Thursday, September 7, 2023 at 10:36:35 AM UTC-4, Brian Schenkenberger wrote:
> I need to tell a customer how to map, assuming this is even possible, a
> global section into which I write data for them. They only do COBOL. :(
> Is this possibe? How does one reference the data once mapped in the
> expanded region? I've tried to make heads or tails of COBOL but I get
> totally lost in the PICs.
>
> If only somebody would do what Jim Duff did for calling system services
> with C but using COBOL. So very few examples exist.
>
> — VAXman (still on the outside trying to look into VMS x86)
There was a programming VMS using Cobol class many years ago that had examples of these routines and how to use them. I should have a hardcopy around. Check the net for PDFs, they may exist.

Dan

Re: COBOL example $MGBLSC

<udd26q$32pot$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29712&group=comp.os.vms#29712

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mai...@SendSpamHere.ORG (Brian Schenkenberger)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Thu, 7 Sep 2023 13:44:58 -0400
Organization: Tmesis Software
Lines: 68
Message-ID: <udd26q$32pot$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="36cba33aa45007410312978d251b7c7a";
logging-data="3237661"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+OAYWn9WCmH/Id+nDdOdLK"
User-Agent: Unison/2.2
Cancel-Lock: sha1:K+yH/j73hQpmQtwe2YjDWpstBL8=
 by: Brian Schenkenberger - Thu, 7 Sep 2023 17:44 UTC

On 2023-09-07 14:36:31 +0000, Brian Schenkenberger said:

> I need to tell a customer how to map, assuming this is even possible, a
> global section into which I write data for them. They only do COBOL. :(
> Is this possibe? How does one reference the data once mapped in the
> expanded region? I've tried to make heads or tails of COBOL but I get
> totally lost in the PICs.
>
> If only somebody would do what Jim Duff did for calling system services
> with C but using COBOL. So very few examples exist.
>
> — VAXman (still on the outside trying to look into VMS x86)

OK. I've gotten this far but now I have no idea how to access the data
in the mapped region.

IDENTIFICATION DIVISION.
PROGRAM-ID. SYSMGBLS.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.

*** EXTERNAL VALUE from SEC.MAR ($SECDEF GLOBAL)
*** $ MACRO SEC.MAR
*** $ LINK SYSMGBLSC,SEC

01 SEC$M_EXPREG PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_EXPREG.
01 SEC$M_PERM PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_PERM.
01 SEC$M_SYSGBL PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_SYSGBL.

01 FLAGS PIC S9(09) COMP VALUE IS 0.

01 RETSTS PIC S9(09) COMP VALUE IS 0.
01 GBLSECNAM PIC X(21) VALUE IS "A-GLOBAL-SECTION-NAME".

01 INADR.
02 ADDRESS-1 PIC S9(09) COMP VALUE IS 512.
02 ADDRESS-2 PIC S9(09) COMP VALUE IS 512.

01 RETADR.
02 ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
02 ADDRESS-2 PIC S9(09) COMP VALUE IS 0.

PROCEDURE DIVISION.
0-BEGIN.

ADD SEC$M_EXPREG TO FLAGS.
ADD SEC$M_PERM TO FLAGS.
ADD SEC$M_SYSGBL TO FLAGS.

CALL "SYS$MGBLSC" USING BY REFERENCE INADR,
BY REFERENCE RETADR,
OMITTED,
BY VALUE FLAGS,
BY DESCRIPTOR GBLSECNAM,
OMITTED,
OMITTED
GIVING RETSTS.

IF RETSTS IS FAILURE CALL "LIB$SIGNAL" USING BY VALUE RETSTS.

IF RETSTS IS SUCCESS DISPLAY "GLOBAL SECTION MAPPED".

*** NOW WHAT???

0-END.
STOP RUN.

Re: COBOL example $MGBLSC

<uddd48$348jj$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29715&group=comp.os.vms#29715

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Thu, 7 Sep 2023 16:51:20 -0400
Organization: A noiseless patient Spider
Lines: 159
Message-ID: <uddd48$348jj$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 7 Sep 2023 20:51:20 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="d932627a9f2424c1770902e95fe32d0f";
logging-data="3285619"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19varH1T3ZFuZApPtC4seVcelM1jICNsso="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:F7acYDZVuZJUbWFjQTFqUwpmZdY=
In-Reply-To: <udd26q$32pot$1@dont-email.me>
Content-Language: en-US
 by: Arne Vajhøj - Thu, 7 Sep 2023 20:51 UTC

On 9/7/2023 1:44 PM, Brian Schenkenberger wrote:
> On 2023-09-07 14:36:31 +0000, Brian Schenkenberger said:
>> I need to tell a customer how to map, assuming this is even possible,
>> a global section into which I write data for them. They only do COBOL.
>> :( Is this possibe? How does one reference the data once mapped in the
>> expanded region? I've tried to make heads or tails of COBOL but I get
>> totally lost in the PICs.
>>
>> If only somebody would do what Jim Duff did for calling system
>> services with C but using COBOL. So very few examples exist.
>
> OK.  I've gotten this far but now I have no idea how to access the data
> in the mapped region.
>
> IDENTIFICATION DIVISION.
> PROGRAM-ID. SYSMGBLS.
> ENVIRONMENT DIVISION.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
>
> ***  EXTERNAL VALUE from SEC.MAR ($SECDEF GLOBAL)
> ***  $ MACRO SEC.MAR
> ***  $ LINK SYSMGBLSC,SEC
>
> 01 SEC$M_EXPREG    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_EXPREG.
> 01 SEC$M_PERM    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_PERM.
> 01 SEC$M_SYSGBL    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_SYSGBL.
>
> 01 FLAGS  PIC S9(09) COMP VALUE IS 0.
>
> 01 RETSTS PIC S9(09) COMP VALUE IS 0.
> 01 GBLSECNAM PIC X(21) VALUE IS "A-GLOBAL-SECTION-NAME".
>
> 01 INADR.
>  02 ADDRESS-1 PIC S9(09) COMP VALUE IS 512.
>  02 ADDRESS-2 PIC S9(09) COMP VALUE IS 512.
>
> 01 RETADR.
>  02 ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
>  02 ADDRESS-2 PIC S9(09) COMP VALUE IS 0.
>
> PROCEDURE DIVISION.
> 0-BEGIN.
>
>    ADD SEC$M_EXPREG TO FLAGS.
>    ADD SEC$M_PERM TO FLAGS.
>    ADD SEC$M_SYSGBL TO FLAGS.
>
>    CALL "SYS$MGBLSC"    USING    BY REFERENCE INADR,
>                 BY REFERENCE RETADR,
>                 OMITTED,
>                 BY VALUE FLAGS,
>                 BY DESCRIPTOR GBLSECNAM,
>                 OMITTED,
>                 OMITTED
>             GIVING    RETSTS.
>
>    IF RETSTS IS FAILURE CALL "LIB$SIGNAL" USING BY VALUE RETSTS.
>
>    IF RETSTS IS SUCCESS DISPLAY "GLOBAL SECTION MAPPED".
>
> *** NOW WHAT???
>
> 0-END.
>    STOP RUN.

I think you will need a hack.

:-)

For inspiration:

$ type main.cob
IDENTIFICATION DIVISION.
PROGRAM-ID. SYSMGBLS.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.

*** EXTERNAL VALUE from SEC.MAR ($SECDEF GLOBAL)
*** $ MACRO SEC.MAR
*** $ LINK SYSMGBLSC,SEC

01 SEC$M_EXPREG PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_EXPREG.
01 SEC$M_PERM PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_PERM.
01 SEC$M_SYSGBL PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_SYSGBL.

01 FLAGS PIC S9(09) COMP VALUE IS 0.

01 RETSTS PIC S9(09) COMP VALUE IS 0.
01 GBLSECNAM PIC X(21) VALUE IS "A-GLOBAL-SECTION-NAME".

01 INADR.
02 IN-ADDRESS-1 PIC S9(09) COMP VALUE IS 512.
02 IN-ADDRESS-2 PIC S9(09) COMP VALUE IS 512.

01 RETADR.
02 RET-ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
02 RET-ADDRESS-2 PIC S9(09) COMP VALUE IS 0.

01 DATA-LEN PIC S9(09) COMP VALUE IS 81920.

PROCEDURE DIVISION.
0-BEGIN.

ADD SEC$M_EXPREG TO FLAGS.

CALL "SYS$MGBLSC" USING BY REFERENCE INADR,
BY REFERENCE RETADR,
OMITTED,
BY VALUE FLAGS,
BY DESCRIPTOR GBLSECNAM,
OMITTED,
OMITTED
GIVING RETSTS.

IF RETSTS IS FAILURE CALL "LIB$SIGNAL" USING BY VALUE RETSTS.

IF RETSTS IS SUCCESS DISPLAY "GLOBAL SECTION MAPPED".

CALL "BRIAN" USING BY REFERENCE DATA-LEN, BY VALUE RET-ADDRESS-1.

0-END.
STOP RUN.
$ type brian.cob
IDENTIFICATION DIVISION.
PROGRAM-ID.BRIAN.
* DATA DIVISION.
WORKING-STORAGE SECTION.
01 NBYT2 PIC S9(9) DISPLAY.
01 CVAL PIC S9(9) DISPLAY.
LINKAGE SECTION.
01 NBYT PIC 9(9) COMP.
01 BLOB.
03 BYT PIC X OCCURS 1000000 TIMES.
* PROCEDURE DIVISION USING NBYT BLOB.
ACK-PARAGRAPH.
MOVE NBYT TO NBYT2
DISPLAY NBYT2
MOVE FUNCTION ORD(BYT(1)) TO CVAL
DISPLAY CVAL.
END PROGRAM BRIAN.
$ @cob
$ cob main
$ cob brian
$ link main + brian
$ run main
GLOBAL SECTION MAPPED
00008192{
00000017H

And yes - the first byte of that global section I setup for the test
has value of 177.

Arne

Re: COBOL example $MGBLSC

<uddieo$353co$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29718&group=comp.os.vms#29718

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mai...@SendSpamHere.ORG (Brian Schenkenberger)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Thu, 7 Sep 2023 18:22:16 -0400
Organization: Tmesis Software
Lines: 5
Message-ID: <uddieo$353co$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me> <uddd48$348jj$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="e5a2ef8cc132f81e91875f056ac2a4b9";
logging-data="3313048"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tO1W1GhAIfbd8wJqVPD7h"
User-Agent: Unison/2.2
Cancel-Lock: sha1:C0Cmav1P+8qUR1Jq+2CYOS1aXyM=
 by: Brian Schenkenberger - Thu, 7 Sep 2023 22:22 UTC

On 2023-09-07 20:51:20 +0000, Arne Vajhj said:

Re: COBOL example $MGBLSC

<uddimg$35476$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29719&group=comp.os.vms#29719

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mai...@SendSpamHere.ORG (Brian Schenkenberger)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Thu, 7 Sep 2023 18:26:24 -0400
Organization: Tmesis Software
Lines: 168
Message-ID: <uddimg$35476$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me> <uddd48$348jj$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="e5a2ef8cc132f81e91875f056ac2a4b9";
logging-data="3313894"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX183eUKAlqwESjbKSmUTiW5A"
User-Agent: Unison/2.2
Cancel-Lock: sha1:UwXh+RVCKIaBkgg3pCBBcdrYXCU=
 by: Brian Schenkenberger - Thu, 7 Sep 2023 22:26 UTC

On 2023-09-07 20:51:20 +0000, Arne Vajhj said:

> On 9/7/2023 1:44 PM, Brian Schenkenberger wrote:
>> On 2023-09-07 14:36:31 +0000, Brian Schenkenberger said:
>>> I need to tell a customer how to map, assuming this is even possible, a
>>> global section into which I write data for them. They only do COBOL. :(
>>> Is this possibe? How does one reference the data once mapped in the
>>> expanded region? I've tried to make heads or tails of COBOL but I get
>>> totally lost in the PICs.
>>>
>>> If only somebody would do what Jim Duff did for calling system services
>>> with C but using COBOL. So very few examples exist.
>>
>> OK.  I've gotten this far but now I have no idea how to access the data
>> in the mapped region.
>>
>> IDENTIFICATION DIVISION.
>> PROGRAM-ID. SYSMGBLS.
>> ENVIRONMENT DIVISION.
>> DATA DIVISION.
>> WORKING-STORAGE SECTION.
>>
>> ***  EXTERNAL VALUE from SEC.MAR ($SECDEF GLOBAL)
>> ***  $ MACRO SEC.MAR
>> ***  $ LINK SYSMGBLSC,SEC
>>
>> 01 SEC$M_EXPREG    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_EXPREG.
>> 01 SEC$M_PERM    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_PERM.
>> 01 SEC$M_SYSGBL    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_SYSGBL.
>>
>> 01 FLAGS  PIC S9(09) COMP VALUE IS 0.
>>
>> 01 RETSTS PIC S9(09) COMP VALUE IS 0.
>> 01 GBLSECNAM PIC X(21) VALUE IS "A-GLOBAL-SECTION-NAME".
>>
>> 01 INADR.
>>  02 ADDRESS-1 PIC S9(09) COMP VALUE IS 512.
>>  02 ADDRESS-2 PIC S9(09) COMP VALUE IS 512.
>>
>> 01 RETADR.
>>  02 ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
>>  02 ADDRESS-2 PIC S9(09) COMP VALUE IS 0.
>>
>> PROCEDURE DIVISION.
>> 0-BEGIN.
>>
>>    ADD SEC$M_EXPREG TO FLAGS.
>>    ADD SEC$M_PERM TO FLAGS.
>>    ADD SEC$M_SYSGBL TO FLAGS.
>>
>>    CALL "SYS$MGBLSC"    USING    BY REFERENCE INADR,
>>                 BY REFERENCE RETADR,
>>                 OMITTED,
>>                 BY VALUE FLAGS,
>>                 BY DESCRIPTOR GBLSECNAM,
>>                 OMITTED,
>>                 OMITTED
>>             GIVING    RETSTS.
>>
>>    IF RETSTS IS FAILURE CALL "LIB$SIGNAL" USING BY VALUE RETSTS.
>>
>>    IF RETSTS IS SUCCESS DISPLAY "GLOBAL SECTION MAPPED".
>>
>> *** NOW WHAT???
>>
>> 0-END.
>>    STOP RUN.
>
> I think you will need a hack.
>
> :-)
>
> For inspiration:
>
> $ type main.cob
> IDENTIFICATION DIVISION.
> PROGRAM-ID. SYSMGBLS.
> ENVIRONMENT DIVISION.
> DATA DIVISION.
> WORKING-STORAGE SECTION.
>
> *** EXTERNAL VALUE from SEC.MAR ($SECDEF GLOBAL)
> *** $ MACRO SEC.MAR
> *** $ LINK SYSMGBLSC,SEC
>
> 01 SEC$M_EXPREG PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_EXPREG.
> 01 SEC$M_PERM PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_PERM.
> 01 SEC$M_SYSGBL PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_SYSGBL.
>
> 01 FLAGS PIC S9(09) COMP VALUE IS 0.
>
> 01 RETSTS PIC S9(09) COMP VALUE IS 0.
> 01 GBLSECNAM PIC X(21) VALUE IS "A-GLOBAL-SECTION-NAME".
>
> 01 INADR.
> 02 IN-ADDRESS-1 PIC S9(09) COMP VALUE IS 512.
> 02 IN-ADDRESS-2 PIC S9(09) COMP VALUE IS 512.
>
> 01 RETADR.
> 02 RET-ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
> 02 RET-ADDRESS-2 PIC S9(09) COMP VALUE IS 0.
>
> 01 DATA-LEN PIC S9(09) COMP VALUE IS 81920.
>
> PROCEDURE DIVISION.
> 0-BEGIN.
>
> ADD SEC$M_EXPREG TO FLAGS.
>
> CALL "SYS$MGBLSC" USING BY REFERENCE INADR,
> BY REFERENCE RETADR,
> OMITTED,
> BY VALUE FLAGS,
> BY DESCRIPTOR GBLSECNAM,
> OMITTED,
> OMITTED
> GIVING RETSTS.
>
> IF RETSTS IS FAILURE CALL "LIB$SIGNAL" USING BY VALUE RETSTS.
>
> IF RETSTS IS SUCCESS DISPLAY "GLOBAL SECTION MAPPED".
>
> CALL "BRIAN" USING BY REFERENCE DATA-LEN, BY VALUE RET-ADDRESS-1.
>
> 0-END.
> STOP RUN.
> $ type brian.cob
> IDENTIFICATION DIVISION.
> PROGRAM-ID.BRIAN.
> *
> DATA DIVISION.
> WORKING-STORAGE SECTION.
> 01 NBYT2 PIC S9(9) DISPLAY.
> 01 CVAL PIC S9(9) DISPLAY.
> LINKAGE SECTION.
> 01 NBYT PIC 9(9) COMP.
> 01 BLOB.
> 03 BYT PIC X OCCURS 1000000 TIMES.
> *
> PROCEDURE DIVISION USING NBYT BLOB.
> ACK-PARAGRAPH.
> MOVE NBYT TO NBYT2
> DISPLAY NBYT2
> MOVE FUNCTION ORD(BYT(1)) TO CVAL
> DISPLAY CVAL.
> END PROGRAM BRIAN.
> $ @cob
> $ cob main
> $ cob brian
> $ link main + brian
> $ run main
> GLOBAL SECTION MAPPED
> 00008192{
> 00000017H
>
> And yes - the first byte of that global section I setup for the test
> has value of 177.
>
> Arne

Thanks for trying. I'm totally lost. Why are you DISPLAYing in the
data segment? FUNCTION ORD?

This "language" has a POINTER feature but I can't figure out how to use
it. Isn't there an example ANYWHERE on the net where $EXPREG or
LIB$GET_VM is used in COBOL?

Re: COBOL example $MGBLSC

<uddlte$35f98$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29720&group=comp.os.vms#29720

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Thu, 7 Sep 2023 19:21:18 -0400
Organization: A noiseless patient Spider
Lines: 138
Message-ID: <uddlte$35f98$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 7 Sep 2023 23:21:19 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1e604f66f88c945e33d61071c4159ccf";
logging-data="3325224"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+9g4D+1dot4d2Vzq8S4E3h6Gih+pdeDhU="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:GsIFoBmUoaAKftRD55rRjofeMrw=
In-Reply-To: <uddimg$35476$1@dont-email.me>
Content-Language: en-US
 by: Arne Vajhøj - Thu, 7 Sep 2023 23:21 UTC

On 9/7/2023 6:26 PM, Brian Schenkenberger wrote:
> On 2023-09-07 20:51:20 +0000, Arne Vajhj said:
>> For inspiration:
>>
>> $ type main.cob
>> IDENTIFICATION DIVISION.
>> PROGRAM-ID. SYSMGBLS.
>> ENVIRONMENT DIVISION.
>> DATA DIVISION.
>> WORKING-STORAGE SECTION.
>>
>> ***  EXTERNAL VALUE from SEC.MAR ($SECDEF GLOBAL)
>> ***  $ MACRO SEC.MAR
>> ***  $ LINK SYSMGBLSC,SEC
>>
>> 01 SEC$M_EXPREG    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_EXPREG.
>> 01 SEC$M_PERM    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_PERM.
>> 01 SEC$M_SYSGBL    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_SYSGBL.
>>
>> 01 FLAGS  PIC S9(09) COMP VALUE IS 0.
>>
>> 01 RETSTS PIC S9(09) COMP VALUE IS 0.
>> 01 GBLSECNAM PIC X(21) VALUE IS "A-GLOBAL-SECTION-NAME".
>>
>> 01 INADR.
>>   02 IN-ADDRESS-1 PIC S9(09) COMP VALUE IS 512.
>>   02 IN-ADDRESS-2 PIC S9(09) COMP VALUE IS 512.
>>
>> 01 RETADR.
>>   02 RET-ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
>>   02 RET-ADDRESS-2 PIC S9(09) COMP VALUE IS 0.
>>
>> 01 DATA-LEN PIC S9(09) COMP VALUE IS 81920.
>>
>> PROCEDURE DIVISION.
>> 0-BEGIN.
>>
>>        ADD SEC$M_EXPREG TO FLAGS.
>>
>>        CALL "SYS$MGBLSC"    USING    BY REFERENCE INADR,
>>                  BY REFERENCE RETADR,
>>                  OMITTED,
>>                  BY VALUE FLAGS,
>>                  BY DESCRIPTOR GBLSECNAM,
>>                  OMITTED,
>>                  OMITTED
>>              GIVING    RETSTS.
>>
>>        IF RETSTS IS FAILURE CALL "LIB$SIGNAL" USING BY VALUE RETSTS.
>>
>>        IF RETSTS IS SUCCESS DISPLAY "GLOBAL SECTION MAPPED".
>>
>>        CALL "BRIAN" USING BY REFERENCE DATA-LEN, BY VALUE RET-ADDRESS-1.
>>
>> 0-END.
>>        STOP RUN.
>> $ type brian.cob
>> IDENTIFICATION DIVISION.
>> PROGRAM-ID.BRIAN.
>> *
>> DATA DIVISION.
>> WORKING-STORAGE SECTION.
>> 01 NBYT2 PIC S9(9) DISPLAY.
>> 01 CVAL PIC S9(9) DISPLAY.
>> LINKAGE SECTION.
>> 01 NBYT PIC 9(9) COMP.
>> 01 BLOB.
>>    03 BYT PIC X OCCURS 1000000 TIMES.
>> *
>> PROCEDURE DIVISION USING NBYT BLOB.
>> ACK-PARAGRAPH.
>>      MOVE NBYT TO NBYT2
>>      DISPLAY NBYT2
>>      MOVE FUNCTION ORD(BYT(1)) TO CVAL
>>      DISPLAY CVAL.
>>      END PROGRAM BRIAN.
>> $ @cob
>> $ cob main
>> $ cob brian
>> $ link main + brian
>> $ run main
>> GLOBAL SECTION MAPPED
>> 00008192{
>> 00000017H
>>
>> And yes - the first byte of that global section I setup for the test
>> has value of 177.
>
> Thanks for trying.  I'm totally lost. Why are you DISPLAYing in the data
> segment? FUNCTION ORD?

The routine BRIAN just displays the length passed and
the first byte of the data passed.

It is to verify that the call is working.

The hack is this:

>> 01 RETADR.
>> 02 RET-ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
>> 02 RET-ADDRESS-2 PIC S9(09) COMP VALUE IS 0.

>> CALL "SYS$MGBLSC" USING BY REFERENCE INADR,
>> BY REFERENCE RETADR,

RET-ADDRESS-1 and RET_ADDRESS-2 are lonmgwords
that after the call to MGBLSC contains start
and end address of the mapped area.

>> CALL "BRIAN" USING BY REFERENCE DATA-LEN, BY VALUE RET-ADDRESS-1.

Now we call BRIAN with second argument being a longword passed
by value.

But a longword that contains an address.

>> LINKAGE SECTION.
>> 01 NBYT PIC 9(9) COMP.
>> 01 BLOB.
>> 03 BYT PIC X OCCURS 1000000 TIMES.
>> *
>> PROCEDURE DIVISION USING NBYT BLOB.

BRIAN expect a structure BLOB (containing a byte array here,
but it could be anything) passed by reference.

SO the trick is to pass a longword by value containing the
address to a routine expecting a structure by reference.

> This "language" has a POINTER feature but I can't figure out how to use
> it. Isn't there an example ANYWHERE on the net where $EXPREG or
> LIB$GET_VM is used in COBOL?

I believe POINTER is just a container.

Arne

Re: COBOL example $MGBLSC

<8c67e2cd-c71e-4dbc-ace5-3c9ca368c7dfn@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29725&group=comp.os.vms#29725

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:620a:40c6:b0:76d:8cc1:559d with SMTP id g6-20020a05620a40c600b0076d8cc1559dmr23997qko.15.1694137831342;
Thu, 07 Sep 2023 18:50:31 -0700 (PDT)
X-Received: by 2002:a05:6a00:178b:b0:68e:4a66:bc14 with SMTP id
s11-20020a056a00178b00b0068e4a66bc14mr412328pfg.3.1694137830729; Thu, 07 Sep
2023 18:50:30 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.niel.me!glou.org!news.glou.org!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Thu, 7 Sep 2023 18:50:30 -0700 (PDT)
In-Reply-To: <uddlte$35f98$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=73.60.222.222; posting-account=M3IgSwoAAADJd6EnOmsrCCfB6_OyTOkv
NNTP-Posting-Host: 73.60.222.222
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me> <uddlte$35f98$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8c67e2cd-c71e-4dbc-ace5-3c9ca368c7dfn@googlegroups.com>
Subject: Re: COBOL example $MGBLSC
From: xyzzy1...@gmail.com (John Reagan)
Injection-Date: Fri, 08 Sep 2023 01:50:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: John Reagan - Fri, 8 Sep 2023 01:50 UTC

On Thursday, September 7, 2023 at 7:21:22 PM UTC-4, Arne Vajhøj wrote:
> On 9/7/2023 6:26 PM, Brian Schenkenberger wrote:
> > On 2023-09-07 20:51:20 +0000, Arne Vajh j said:
> >> For inspiration:
> >>
> >> $ type main.cob
> >> IDENTIFICATION DIVISION.
> >> PROGRAM-ID. SYSMGBLS.
> >> ENVIRONMENT DIVISION.
> >> DATA DIVISION.
> >> WORKING-STORAGE SECTION.
> >>
> >> *** EXTERNAL VALUE from SEC.MAR ($SECDEF GLOBAL)
> >> *** $ MACRO SEC.MAR
> >> *** $ LINK SYSMGBLSC,SEC
> >>
> >> 01 SEC$M_EXPREG PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_EXPREG.
> >> 01 SEC$M_PERM PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_PERM.
> >> 01 SEC$M_SYSGBL PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_SYSGBL.
> >>
> >> 01 FLAGS PIC S9(09) COMP VALUE IS 0.
> >>
> >> 01 RETSTS PIC S9(09) COMP VALUE IS 0.
> >> 01 GBLSECNAM PIC X(21) VALUE IS "A-GLOBAL-SECTION-NAME".
> >>
> >> 01 INADR.
> >> 02 IN-ADDRESS-1 PIC S9(09) COMP VALUE IS 512.
> >> 02 IN-ADDRESS-2 PIC S9(09) COMP VALUE IS 512.
> >>
> >> 01 RETADR.
> >> 02 RET-ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
> >> 02 RET-ADDRESS-2 PIC S9(09) COMP VALUE IS 0.
> >>
> >> 01 DATA-LEN PIC S9(09) COMP VALUE IS 81920.
> >>
> >> PROCEDURE DIVISION.
> >> 0-BEGIN.
> >>
> >> ADD SEC$M_EXPREG TO FLAGS.
> >>
> >> CALL "SYS$MGBLSC" USING BY REFERENCE INADR,
> >> BY REFERENCE RETADR,
> >> OMITTED,
> >> BY VALUE FLAGS,
> >> BY DESCRIPTOR GBLSECNAM,
> >> OMITTED,
> >> OMITTED
> >> GIVING RETSTS.
> >>
> >> IF RETSTS IS FAILURE CALL "LIB$SIGNAL" USING BY VALUE RETSTS.
> >>
> >> IF RETSTS IS SUCCESS DISPLAY "GLOBAL SECTION MAPPED".
> >>
> >> CALL "BRIAN" USING BY REFERENCE DATA-LEN, BY VALUE RET-ADDRESS-1.
> >>
> >> 0-END.
> >> STOP RUN.
> >> $ type brian.cob
> >> IDENTIFICATION DIVISION.
> >> PROGRAM-ID.BRIAN.
> >> *
> >> DATA DIVISION.
> >> WORKING-STORAGE SECTION.
> >> 01 NBYT2 PIC S9(9) DISPLAY.
> >> 01 CVAL PIC S9(9) DISPLAY.
> >> LINKAGE SECTION.
> >> 01 NBYT PIC 9(9) COMP.
> >> 01 BLOB.
> >> 03 BYT PIC X OCCURS 1000000 TIMES.
> >> *
> >> PROCEDURE DIVISION USING NBYT BLOB.
> >> ACK-PARAGRAPH.
> >> MOVE NBYT TO NBYT2
> >> DISPLAY NBYT2
> >> MOVE FUNCTION ORD(BYT(1)) TO CVAL
> >> DISPLAY CVAL.
> >> END PROGRAM BRIAN.
> >> $ @cob
> >> $ cob main
> >> $ cob brian
> >> $ link main + brian
> >> $ run main
> >> GLOBAL SECTION MAPPED
> >> 00008192{
> >> 00000017H
> >>
> >> And yes - the first byte of that global section I setup for the test
> >> has value of 177.
> >
> > Thanks for trying. I'm totally lost. Why are you DISPLAYing in the data
> > segment? FUNCTION ORD?
> The routine BRIAN just displays the length passed and
> the first byte of the data passed.
>
> It is to verify that the call is working.
>
> The hack is this:
> >> 01 RETADR.
> >> 02 RET-ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
> >> 02 RET-ADDRESS-2 PIC S9(09) COMP VALUE IS 0.
> >> CALL "SYS$MGBLSC" USING BY REFERENCE INADR,
> >> BY REFERENCE RETADR,
> RET-ADDRESS-1 and RET_ADDRESS-2 are lonmgwords
> that after the call to MGBLSC contains start
> and end address of the mapped area.
> >> CALL "BRIAN" USING BY REFERENCE DATA-LEN, BY VALUE RET-ADDRESS-1.
> Now we call BRIAN with second argument being a longword passed
> by value.
>
> But a longword that contains an address.
> >> LINKAGE SECTION.
> >> 01 NBYT PIC 9(9) COMP.
> >> 01 BLOB.
> >> 03 BYT PIC X OCCURS 1000000 TIMES.
> >> *
> >> PROCEDURE DIVISION USING NBYT BLOB.
> BRIAN expect a structure BLOB (containing a byte array here,
> but it could be anything) passed by reference.
>
> SO the trick is to pass a longword by value containing the
> address to a routine expecting a structure by reference.
> > This "language" has a POINTER feature but I can't figure out how to use
> > it. Isn't there an example ANYWHERE on the net where $EXPREG or
> > LIB$GET_VM is used in COBOL?
> I believe POINTER is just a container.
>
> Arne
Yep, POINTER is one of the few COBOL 2002 keywords in the compiler.
Just a container of the correct size (64-bits) but you can't really operate on
it. You can just pass it to some other routine (in another language that CAN
operate on such things)

Re: COBOL example $MGBLSC

<udf2sp$3eti4$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29731&group=comp.os.vms#29731

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mai...@SendSpamHere.ORG (Brian Schenkenberger)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 08:08:57 -0400
Organization: Tmesis Software
Lines: 21
Message-ID: <udf2sp$3eti4$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me> <uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me> <uddlte$35f98$1@dont-email.me> <8c67e2cd-c71e-4dbc-ace5-3c9ca368c7dfn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="4c56f65b46c4964e2d1bc50413c9d2f4";
logging-data="3634756"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/SONnP3zo+v3c3HOrayNS8"
User-Agent: Unison/2.2
Cancel-Lock: sha1:afWM9O1KbyzM7LdBH08N70cCbcI=
 by: Brian Schenkenberger - Fri, 8 Sep 2023 12:08 UTC

On 2023-09-08 01:50:30 +0000, John Reagan said:

> Yep, POINTER is one of the few COBOL 2002 keywords in the compiler.
> Just a container of the correct size (64-bits) but you can't really
> operate onit. You can just pass it to some other routine (in another
> language that CAN
> operate on such things)

So, it's useless. I've been trying COBOL examples I've found on the net
and they fail. That explains why.

So there's no way to $MGBLSC, $EXPREG, LIB$GET_VM and use the region
created directly in COBOL.

Grrrr.

Thanks John. At least I won't be banging my head against the wall
trying to figure out this COBOL.

— Brian

Re: COBOL example $MGBLSC

<1b52d61e-5e9c-4509-b416-6727ddd1bb2bn@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29733&group=comp.os.vms#29733

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ad4:5884:0:b0:635:e5ff:b4b7 with SMTP id dz4-20020ad45884000000b00635e5ffb4b7mr43580qvb.3.1694175257389;
Fri, 08 Sep 2023 05:14:17 -0700 (PDT)
X-Received: by 2002:a17:902:d489:b0:1bc:e6a:205e with SMTP id
c9-20020a170902d48900b001bc0e6a205emr898061plg.5.1694175256852; Fri, 08 Sep
2023 05:14:16 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Fri, 8 Sep 2023 05:14:16 -0700 (PDT)
In-Reply-To: <udf2sp$3eti4$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=73.60.222.222; posting-account=M3IgSwoAAADJd6EnOmsrCCfB6_OyTOkv
NNTP-Posting-Host: 73.60.222.222
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <8c67e2cd-c71e-4dbc-ace5-3c9ca368c7dfn@googlegroups.com>
<udf2sp$3eti4$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1b52d61e-5e9c-4509-b416-6727ddd1bb2bn@googlegroups.com>
Subject: Re: COBOL example $MGBLSC
From: xyzzy1...@gmail.com (John Reagan)
Injection-Date: Fri, 08 Sep 2023 12:14:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2503
 by: John Reagan - Fri, 8 Sep 2023 12:14 UTC

On Friday, September 8, 2023 at 8:09:01 AM UTC-4, Brian Schenkenberger wrote:
> On 2023-09-08 01:50:30 +0000, John Reagan said:
>
> > Yep, POINTER is one of the few COBOL 2002 keywords in the compiler.
> > Just a container of the correct size (64-bits) but you can't really
> > operate onit. You can just pass it to some other routine (in another
> > language that CAN
> > operate on such things)
> So, it's useless. I've been trying COBOL examples I've found on the net
> and they fail. That explains why.
>
> So there's no way to $MGBLSC, $EXPREG, LIB$GET_VM and use the region
> created directly in COBOL.
>
> Grrrr.
>
> Thanks John. At least I won't be banging my head against the wall
> trying to figure out this COBOL.
>
> — Brian
I wasn't in the meetings with the COBOL team to hear if they were planning
to add additional COBOL 2002 support that would include the ability to
operate. I don't remember hearing about it at the lunch table (which is where
I got most of my information at that time). Regardless, you are correct, I
don't think you can write an all-COBOL solution

John

Re: COBOL example $MGBLSC

<udf3ru$3f1ja$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29736&group=comp.os.vms#29736

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 08:25:34 -0400
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <udf3ru$3f1ja$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me>
<8c67e2cd-c71e-4dbc-ace5-3c9ca368c7dfn@googlegroups.com>
<udf2sp$3eti4$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 8 Sep 2023 12:25:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1e604f66f88c945e33d61071c4159ccf";
logging-data="3638890"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18n7gXC5BIzXBPGo5ZHSsKZdvG3ADNrCwA="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:63YJvllZVi7eOcTyqRIUQw+QzLo=
In-Reply-To: <udf2sp$3eti4$1@dont-email.me>
Content-Language: en-US
 by: Arne Vajhøj - Fri, 8 Sep 2023 12:25 UTC

On 9/8/2023 8:08 AM, Brian Schenkenberger wrote:
> On 2023-09-08 01:50:30 +0000, John Reagan said:
>> Yep, POINTER is one of the few COBOL 2002 keywords in the compiler.
>> Just a container of the correct size (64-bits) but you can't really
>> operate onit.  You can just pass it to some other routine (in another
>> language that CAN
>> operate on such things)
>
> So, it's useless. I've been trying COBOL examples I've found on the net
> and they fail.  That explains why.
>
> So there's no way to $MGBLSC, $EXPREG, LIB$GET_VM and use the region
> created directly in COBOL.

POINTER may be "useless".

But as I showed you just pass an integer with the address by value
to a routine expecting something by reference.

Arne

Re: COBOL example $MGBLSC

<udf3s2$3erta$3@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29737&group=comp.os.vms#29737

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: club...@remove_me.eisner.decus.org-Earth.UFP (Simon Clubley)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 12:25:38 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <udf3s2$3erta$3@dont-email.me>
References: <udcn5f$31542$1@dont-email.me>
Injection-Date: Fri, 8 Sep 2023 12:25:38 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7eaf6d7628ebd6fcf41d43c64438f4a6";
logging-data="3633066"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+BW90s090XwJuUW4paJ0YfQCrIgugG80s="
User-Agent: slrn/0.9.8.1 (VMS/Multinet)
Cancel-Lock: sha1:Hsopt/+krKJFVR69q/cxgByHgjc=
 by: Simon Clubley - Fri, 8 Sep 2023 12:25 UTC

On 2023-09-07, Brian Schenkenberger <mail@SendSpamHere.ORG> wrote:
>
> ? VAXman (still on the outside trying to look into VMS x86)
>

Where exactly are you being blocked from registering for the x86-64
VMS community program and how ?

If it's a browser issue, what browser and OS are you using, and what
have you tried ?

Simon.

--
Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP
Walking destinations on a map are further away than they appear.

Re: COBOL example $MGBLSC

<udf9ep$3fsnc$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29742&group=comp.os.vms#29742

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mai...@SendSpamHere.ORG (Brian Schenkenberger)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 10:00:57 -0400
Organization: Tmesis Software
Lines: 20
Message-ID: <udf9ep$3fsnc$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udf3s2$3erta$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="e5a2ef8cc132f81e91875f056ac2a4b9";
logging-data="3666668"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19tnVbWUoiAlWuzdVJajoss"
User-Agent: Unison/2.2
Cancel-Lock: sha1:ArFJI5fIbsNYivPjbr/+LaoL0v4=
 by: Brian Schenkenberger - Fri, 8 Sep 2023 14:00 UTC

On 2023-09-08 12:25:38 +0000, Simon Clubley said:

> On 2023-09-07, Brian Schenkenberger <mail@SendSpamHere.ORG> wrote:
>>
>> ? VAXman (still on the outside trying to look into VMS x86)
>>
>
> Where exactly are you being blocked from registering for the x86-64
> VMS community program and how ?
>
> If it's a browser issue, what browser and OS are you using, and what
> have you tried ?
>
> Simon.

I got a reply from VSI over a week ago but I'm still in the dark.

I've had several request to port RMS-CDC but that may never ever
happen. C'est la vie.

Re: COBOL example $MGBLSC

<udfj2g$3hote$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29747&group=comp.os.vms#29747

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: mai...@SendSpamHere.ORG (Brian Schenkenberger)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 12:45:04 -0400
Organization: Tmesis Software
Lines: 179
Message-ID: <udfj2g$3hote$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me> <uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me> <uddlte$35f98$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="e5a2ef8cc132f81e91875f056ac2a4b9";
logging-data="3728302"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/b7X4/Ug7cFCaV+LQ2IxFK"
User-Agent: Unison/2.2
Cancel-Lock: sha1:sN9qcfwBsfx6rB9W8vWeTEb6w28=
 by: Brian Schenkenberger - Fri, 8 Sep 2023 16:45 UTC

On 2023-09-07 23:21:18 +0000, Arne Vajhj said:

> On 9/7/2023 6:26 PM, Brian Schenkenberger wrote:
>> On 2023-09-07 20:51:20 +0000, Arne Vajhj said:
>>> For inspiration:
>>>
>>> $ type main.cob
>>> IDENTIFICATION DIVISION.
>>> PROGRAM-ID. SYSMGBLS.
>>> ENVIRONMENT DIVISION.
>>> DATA DIVISION.
>>> WORKING-STORAGE SECTION.
>>>
>>> ***  EXTERNAL VALUE from SEC.MAR ($SECDEF GLOBAL)
>>> ***  $ MACRO SEC.MAR
>>> ***  $ LINK SYSMGBLSC,SEC
>>>
>>> 01 SEC$M_EXPREG    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_EXPREG.
>>> 01 SEC$M_PERM    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_PERM.
>>> 01 SEC$M_SYSGBL    PIC S9(09) COMP VALUE IS EXTERNAL SEC$M_SYSGBL.
>>>
>>> 01 FLAGS  PIC S9(09) COMP VALUE IS 0.
>>>
>>> 01 RETSTS PIC S9(09) COMP VALUE IS 0.
>>> 01 GBLSECNAM PIC X(21) VALUE IS "A-GLOBAL-SECTION-NAME".
>>>
>>> 01 INADR.
>>>   02 IN-ADDRESS-1 PIC S9(09) COMP VALUE IS 512.
>>>   02 IN-ADDRESS-2 PIC S9(09) COMP VALUE IS 512.
>>>
>>> 01 RETADR.
>>>   02 RET-ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
>>>   02 RET-ADDRESS-2 PIC S9(09) COMP VALUE IS 0.
>>>
>>> 01 DATA-LEN PIC S9(09) COMP VALUE IS 81920.
>>>
>>> PROCEDURE DIVISION.
>>> 0-BEGIN.
>>>
>>>        ADD SEC$M_EXPREG TO FLAGS.
>>>
>>>        CALL "SYS$MGBLSC"    USING    BY REFERENCE INADR,
>>>                  BY REFERENCE RETADR,
>>>                  OMITTED,
>>>                  BY VALUE FLAGS,
>>>                  BY DESCRIPTOR GBLSECNAM,
>>>                  OMITTED,
>>>                  OMITTED
>>>              GIVING    RETSTS.
>>>
>>>        IF RETSTS IS FAILURE CALL "LIB$SIGNAL" USING BY VALUE RETSTS.
>>>
>>>        IF RETSTS IS SUCCESS DISPLAY "GLOBAL SECTION MAPPED".
>>>
>>>        CALL "BRIAN" USING BY REFERENCE DATA-LEN, BY VALUE RET-ADDRESS-1.
>>>
>>> 0-END.
>>>        STOP RUN.
>>> $ type brian.cob
>>> IDENTIFICATION DIVISION.
>>> PROGRAM-ID.BRIAN.
>>> *
>>> DATA DIVISION.
>>> WORKING-STORAGE SECTION.
>>> 01 NBYT2 PIC S9(9) DISPLAY.
>>> 01 CVAL PIC S9(9) DISPLAY.
>>> LINKAGE SECTION.
>>> 01 NBYT PIC 9(9) COMP.
>>> 01 BLOB.
>>>    03 BYT PIC X OCCURS 1000000 TIMES.
>>> *
>>> PROCEDURE DIVISION USING NBYT BLOB.
>>> ACK-PARAGRAPH.
>>>      MOVE NBYT TO NBYT2
>>>      DISPLAY NBYT2
>>>      MOVE FUNCTION ORD(BYT(1)) TO CVAL
>>>      DISPLAY CVAL.
>>>      END PROGRAM BRIAN.
>>> $ @cob
>>> $ cob main
>>> $ cob brian
>>> $ link main + brian
>>> $ run main
>>> GLOBAL SECTION MAPPED
>>> 00008192{
>>> 00000017H
>>>
>>> And yes - the first byte of that global section I setup for the test
>>> has value of 177.
>>
>> Thanks for trying.  I'm totally lost. Why are you DISPLAYing in the
>> data segment? FUNCTION ORD?
>
> The routine BRIAN just displays the length passed and
> the first byte of the data passed.
>
> It is to verify that the call is working.
>
> The hack is this:
>
> >> 01 RETADR.
> >> 02 RET-ADDRESS-1 PIC S9(09) COMP VALUE IS 0.
> >> 02 RET-ADDRESS-2 PIC S9(09) COMP VALUE IS 0.
>
> >> CALL "SYS$MGBLSC" USING BY REFERENCE INADR,
> >> BY REFERENCE RETADR,
>
> RET-ADDRESS-1 and RET_ADDRESS-2 are lonmgwords
> that after the call to MGBLSC contains start
> and end address of the mapped area.
>
> >> CALL "BRIAN" USING BY REFERENCE DATA-LEN, BY VALUE RET-ADDRESS-1.
>
> Now we call BRIAN with second argument being a longword passed
> by value.
>
> But a longword that contains an address.
>
> >> LINKAGE SECTION.
> >> 01 NBYT PIC 9(9) COMP.
> >> 01 BLOB.
> >> 03 BYT PIC X OCCURS 1000000 TIMES.
> >> *
> >> PROCEDURE DIVISION USING NBYT BLOB.
>
> BRIAN expect a structure BLOB (containing a byte array here,
> but it could be anything) passed by reference.
>
> SO the trick is to pass a longword by value containing the
> address to a routine expecting a structure by reference.
>
>> This "language" has a POINTER feature but I can't figure out how to use
>> it. Isn't there an example ANYWHERE on the net where $EXPREG or
>> LIB$GET_VM is used in COBOL?
>
> I believe POINTER is just a container.
>
> Arne

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.

I also can't figure out how to define GLOBA:L-SECTION ELEMENT OCCURS *
TIMES. The number of the elements in the global section could be quite
variable.

Re: COBOL example $MGBLSC

<udfkn4$3i47t$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29748&group=comp.os.vms#29748

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 13:13:08 -0400
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <udfkn4$3i47t$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 8 Sep 2023 17:13:08 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1e604f66f88c945e33d61071c4159ccf";
logging-data="3739901"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wwgExwb10IuPPUUSikJ/jQB5qBeno74s="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:tZTGMKbLFBVE2J929FPJ1Qa4P5Y=
Content-Language: en-US
In-Reply-To: <udfj2g$3hote$1@dont-email.me>
 by: Arne Vajhøj - Fri, 8 Sep 2023 17:13 UTC

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 also can't figure out how to define GLOBA:L-SECTION ELEMENT OCCURS *
> TIMES. The number of the elements in the global section could be quite
> variable.

I don't think it is possible.

Just declare it big enough and only access what actually exist.

It is just an address that is being passed.

Arne

Re: COBOL example $MGBLSC

<km15gqF8emlU5@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29750&group=comp.os.vms#29750

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bill.gun...@gmail.com (bill)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 13:55:37 -0400
Lines: 59
Message-ID: <km15gqF8emlU5@mid.individual.net>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
<udfkn4$3i47t$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net 6mAZyvltWICx/6cXA1BBDgv2OC/4TVI7aVFop3hylK5HYJGZOX
Cancel-Lock: sha1:dRIJ7nNvqd2wMukcGEYbhaK9At0= sha256:GqA/9gI8ubPLMpFB05X8rSgEV28FCfw6QfAS8LqwIKg=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Content-Language: en-US
In-Reply-To: <udfkn4$3i47t$1@dont-email.me>
 by: bill - Fri, 8 Sep 2023 17:55 UTC

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

Re: COBOL example $MGBLSC

<udfs7k$3kulu$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29754&group=comp.os.vms#29754

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: dav...@tsoft-inc.com (Dave Froble)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 15:21:06 -0400
Organization: A noiseless patient Spider
Lines: 15
Message-ID: <udfs7k$3kulu$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
<udfkn4$3i47t$1@dont-email.me> <km15gqF8emlU5@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 8 Sep 2023 19:21:24 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e0cee9398558d2f6ced0ba931a7f243c";
logging-data="3832510"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19rWj1xyfx1M+4gY8DbZ9HmKnz5rROKiPc="
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:45.0) Gecko/20100101
Thunderbird/45.8.0
Cancel-Lock: sha1:6h08QADAt6bS1g0wE/u2/O7g2BQ=
In-Reply-To: <km15gqF8emlU5@mid.individual.net>
 by: Dave Froble - Fri, 8 Sep 2023 19:21 UTC

On 9/8/2023 1:55 PM, bill wrote:

> I really don't have that much experience with VMS COBOL and have no idea
> what $MGBLSC means,

Brian is attempting to access a global section from a Cobol program. (Must be a
glutton for punishment.) That is a system service to map to an existing (I
think) global section.

--
David Froble Tel: 724-529-0450
Dave Froble Enterprises, Inc. E-Mail: davef@tsoft-inc.com
DFE Ultralights, Inc.
170 Grimplin Road
Vanderbilt, PA 15486

Re: COBOL example $MGBLSC

<udg0rs$3mbio$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29757&group=comp.os.vms#29757

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 16:40:27 -0400
Organization: A noiseless patient Spider
Lines: 71
Message-ID: <udg0rs$3mbio$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
<udfkn4$3i47t$1@dont-email.me> <km15gqF8emlU5@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 8 Sep 2023 20:40:28 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1e604f66f88c945e33d61071c4159ccf";
logging-data="3878488"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19QmEN7+iCaA+RWtx1wc9ijSBs7L21Jn9Y="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:qElxs82qinXZcU6KyUzdxhxR4kY=
Content-Language: en-US
In-Reply-To: <km15gqF8emlU5@mid.individual.net>
 by: Arne Vajhøj - Fri, 8 Sep 2023 20:40 UTC

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?

> Is this unique to x86-64 or could I play with the examples on EISNER?

Not x86-64 specific. In fact I am pretty sure that Brian is not
running it on x86-64. You could run it on VAX!

Arne

Re: COBOL example $MGBLSC

<km1mq8F8emnU7@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29759&group=comp.os.vms#29759

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bill.gun...@gmail.com (bill)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 18:50:47 -0400
Lines: 84
Message-ID: <km1mq8F8emnU7@mid.individual.net>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
<udfkn4$3i47t$1@dont-email.me> <km15gqF8emlU5@mid.individual.net>
<udg0rs$3mbio$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net js8iwOw/KjyEVyPFCEB0MA/vqiP8cXz5pBvE78iVXMs4ME/wUA
Cancel-Lock: sha1:CdDLraLm6vqIknJXnpTU8Cd0Ls4= sha256:X1b81F3zwtoN8PTkjEt29p5XBmtZul3/aNEZcc40xCM=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Content-Language: en-US
In-Reply-To: <udg0rs$3mbio$1@dont-email.me>
 by: bill - Fri, 8 Sep 2023 22:50 UTC

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.

>
>> Is this unique to x86-64 or could I play with the examples on EISNER?
>
> Not x86-64 specific. In fact I am pretty sure that Brian is not
> running it on x86-64. You could run it on VAX!
>
> Arne
>
>

bill

Re: COBOL example $MGBLSC

<udg90r$3fq1i$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29760&group=comp.os.vms#29760

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: new...@cct-net.co.uk (Chris Townley)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 23:59:39 +0100
Organization: A noiseless patient Spider
Lines: 80
Message-ID: <udg90r$3fq1i$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
<udfkn4$3i47t$1@dont-email.me> <km15gqF8emlU5@mid.individual.net>
<udg0rs$3mbio$1@dont-email.me> <km1mq8F8emnU7@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 8 Sep 2023 22:59:39 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="1d5ef9300e3212a7638e15e71337d5dd";
logging-data="3663922"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+QDYlEPFHFL+YHrJBEux3oM7lU797/Whs="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:l1hv6kOOL4LFQlE1JfLE69xlhQM=
In-Reply-To: <km1mq8F8emnU7@mid.individual.net>
Content-Language: en-GB
 by: Chris Townley - Fri, 8 Sep 2023 22:59 UTC

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

Re: COBOL example $MGBLSC

<km1nfvF8emlU7@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29762&group=comp.os.vms#29762

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bill.gun...@gmail.com (bill)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 19:02:22 -0400
Lines: 86
Message-ID: <km1nfvF8emlU7@mid.individual.net>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
<udfkn4$3i47t$1@dont-email.me> <km15gqF8emlU5@mid.individual.net>
<udg0rs$3mbio$1@dont-email.me> <km1mq8F8emnU7@mid.individual.net>
<udg90r$3fq1i$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net HITlyrjbEudlYVTLGhSnNQy2aJesD/gKkANDEPHlVt9lf+tK1u
Cancel-Lock: sha1:QgDhus9h3RYft3MXVqMtowPtXyE= sha256:t9qEApbbpdryKmz8zZEOfmf6T5RJCcdJwZKoi44i1u0=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Content-Language: en-US
In-Reply-To: <udg90r$3fq1i$1@dont-email.me>
 by: bill - Fri, 8 Sep 2023 23:02 UTC

On 9/8/2023 6:59 PM, Chris Townley wrote:
> 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
>

Thank you. I'll try there. The users guide won;t cut it. I
need the reference guide.

bill

Re: COBOL example $MGBLSC

<538eda3a-ed6a-4e36-abd5-870f0a700a09n@googlegroups.com>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29763&group=comp.os.vms#29763

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:6214:5646:b0:653:5863:c835 with SMTP id mh6-20020a056214564600b006535863c835mr81168qvb.0.1694221377796;
Fri, 08 Sep 2023 18:02:57 -0700 (PDT)
X-Received: by 2002:a17:902:c70c:b0:1c0:ecbb:182b with SMTP id
p12-20020a170902c70c00b001c0ecbb182bmr1248572plp.10.1694221377488; Fri, 08
Sep 2023 18:02:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.os.vms
Date: Fri, 8 Sep 2023 18:02:56 -0700 (PDT)
In-Reply-To: <udfj2g$3hote$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=73.234.171.161; posting-account=U1iMPAoAAAC9r8wm0KaW63EcF8sfjFeH
NNTP-Posting-Host: 73.234.171.161
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <538eda3a-ed6a-4e36-abd5-870f0a700a09n@googlegroups.com>
Subject: Re: COBOL example $MGBLSC
From: heinvand...@gmail.com (Hein RMS van den Heuvel)
Injection-Date: Sat, 09 Sep 2023 01:02:57 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 4569
 by: Hein RMS van den Heu - Sat, 9 Sep 2023 01:02 UTC

On Friday, September 8, 2023 at 12:45:07 PM UTC-4, Brian Schenkenberger wrote:

> I have the SYS$MGBLSC working... at least, in the debugger.:
: > 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.

Good, that creates a subroutine expecting a pointer to a structure, which may be in a global section previously mapped.
But before we go there, what exactly are the customer requirements?
There is also something called 'EXTERNAL DATA', essentially named Psects/common blocks.

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

Ask yourself AITA for expecting a compiler NOT to do exactly what I ask? Garbage in, Garbage out - as requested.

You are TA for being an ancient hack (much like myself) who can only think bits and bytes when he can just do text!
Load your global with ascii "+001" and "-001" or "AAAB" and similar and call it is PIC X(4) or PIC 9(4) USAGE DISPLAY and all will be well :-).

Or... DISPLAY WITH CONVERSION !

Or, RTFM ... "5. Numeric items do not require the CONVERSION phrase to be displayed correctly with conversion if you specify /DISPLAY_FORMATTED (on OpenVMS Alpha")

Or, as Arne suggests, move (= convert) them into a display helper variable and use that.
This may be best for many cases because (if I recall correctly) any use of "WITH CONVERSION" activates some bonus screen handling you may not care for

(I hope I do not have to litter this with smiley's to indicate these are all friendly pokes, do I?)

>
> I also can't figure out how to define GLOBA:L-SECTION ELEMENT OCCURS *
> TIMES. The number of the elements in the global section could be quite
> variable.

With the linkage section it's all just virtual right? take a thousand, take a million, it matters none I suspect -- haven't tried i a while.

Ah... is this a peephole into the actual user requirements?
Are the elements fixed length?
Anyways, could you not make the linkage section just for one 'element' and do pointer math on the outside to provide the right element?
Or provide a second lower level function with just the 1 element also passed as linkage and called from the one you have?
Remember these are functions 'giving', but they can only 'give' an R0 return value. Per Reference Guide: "The identifier must refer to an elementary integer numeric data
item with COMP, COMP-1, or COMP-2 usage and no scaling positions."

Greetings my friend! I'll re-poke some folks for I64 access as we (or rather they! have a mutual shared goal.

Hein.

Re: COBOL example $MGBLSC

<udgklq$3t8m3$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29764&group=comp.os.vms#29764

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 22:18:33 -0400
Organization: A noiseless patient Spider
Lines: 32
Message-ID: <udgklq$3t8m3$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 9 Sep 2023 02:18:34 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e0ca7542e7f8d2c872ca23813f8648e1";
logging-data="4104899"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX187DGdaBkCfpreja6C9zxhBvhua1uUE9Uk="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:XkOJINVztpYuhjh9oKcPP8EMr0E=
In-Reply-To: <udfj2g$3hote$1@dont-email.me>
Content-Language: en-US
 by: Arne Vajhøj - Sat, 9 Sep 2023 02:18 UTC

On 9/8/2023 12:45 PM, Brian Schenkenberger wrote:
> It'd be great too if there was a way to DISPLAY them in HEX

I don't know the right Cobol way to display as hex, but
FAO work in Cobol as well.

identification division.
program-id.hex1.
* data division.
working-storage section.
01 v pic 9(9) comp.
01 fmt pic x(7) value "!SL !XL".
01 buflen pic 9(9) comp.
01 buf pic x(100).
* procedure division.
main-paragraph.
move 123 to v
call "LIB$SYS_FAO"
using
by descriptor fmt
by reference buflen
by descriptor buf
by value v
by value v
end-call
display buf(1:buflen)
stop run.

Arne

Re: COBOL example $MGBLSC

<udglql$3tfkp$1@dont-email.me>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29765&group=comp.os.vms#29765

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: arn...@vajhoej.dk (Arne Vajhøj)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Fri, 8 Sep 2023 22:38:13 -0400
Organization: A noiseless patient Spider
Lines: 59
Message-ID: <udglql$3tfkp$1@dont-email.me>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
<udgklq$3t8m3$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sat, 9 Sep 2023 02:38:13 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="e0ca7542e7f8d2c872ca23813f8648e1";
logging-data="4112025"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19WnDvZxSSpv9LQpb3V5p4qwwLcK+TdJrQ="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:MzD+jsCy82YFT6MzhIHa7wQqeb4=
In-Reply-To: <udgklq$3t8m3$1@dont-email.me>
Content-Language: en-US
 by: Arne Vajhøj - Sat, 9 Sep 2023 02:38 UTC

On 9/8/2023 10:18 PM, Arne Vajhøj wrote:
> On 9/8/2023 12:45 PM, Brian Schenkenberger wrote:
>> It'd be great too if there was a way to DISPLAY them in HEX
>
> I don't know the right Cobol way to display as hex, but
> FAO work in Cobol as well.
>
> identification division.
> program-id.hex1.
> *
> data division.
> working-storage section.
> 01  v       pic 9(9) comp.
> 01  fmt     pic x(7) value "!SL !XL".
> 01  buflen  pic 9(9) comp.
> 01  buf     pic x(100).
> *
> procedure division.
> main-paragraph.
>     move 123 to v
>     call "LIB$SYS_FAO"
>         using
>            by descriptor fmt
>            by reference buflen
>            by descriptor buf
>            by value v
>            by value v
>     end-call
>     display buf(1:buflen)
>     stop run.

Or if you really want to hack it:

identification division.
program-id.hex2.
* data division.
working-storage section.
01 v pic 9(9) comp.
01 fmt pic x(11) value "%d %08x%c%c".
01 cr pic 9(9) comp value 13.
01 lf pic 9(9) comp value 10.
* procedure division.
main-paragraph.
move 123 to v
call "DECC$GXPRINTF"
using
by reference fmt
by value v
by value v
by value cr
by value lf
end-call
stop run.

Arne

Re: COBOL example $MGBLSC

<km39fkF8emlU9@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=29769&group=comp.os.vms#29769

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: bill.gun...@gmail.com (bill)
Newsgroups: comp.os.vms
Subject: Re: COBOL example $MGBLSC
Date: Sat, 9 Sep 2023 09:15:31 -0400
Lines: 102
Message-ID: <km39fkF8emlU9@mid.individual.net>
References: <udcn5f$31542$1@dont-email.me> <udd26q$32pot$1@dont-email.me>
<uddd48$348jj$1@dont-email.me> <uddimg$35476$1@dont-email.me>
<uddlte$35f98$1@dont-email.me> <udfj2g$3hote$1@dont-email.me>
<udfkn4$3i47t$1@dont-email.me> <km15gqF8emlU5@mid.individual.net>
<udg0rs$3mbio$1@dont-email.me> <km1mq8F8emnU7@mid.individual.net>
<udg90r$3fq1i$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net REt6SnfzJN0VcMFlv7OAWQzLdAx2PGI4ewbXjZkKxhNqDJwWZv
Cancel-Lock: sha1:dOX1F5xA6jDgsBrX7uMPmQwXcyo= sha256:iWT9O3/MsCfJ5Lp858St4/TrH7du6DWUBEhT1VTsb1k=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.14.0
Content-Language: en-US
In-Reply-To: <udg90r$3fq1i$1@dont-email.me>
 by: bill - Sat, 9 Sep 2023 13:15 UTC

On 9/8/2023 6:59 PM, Chris Townley wrote:
> 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
>

Afraid I will have to take a pass on this one. Too much VMS
specific stuff that makes no sense to me in COBOL.
An example:
------------------------------
LINKAGE SECTION.

01 GLOBAL-SECTION.

-----------------------

PROCEDURE DIVISION USING GLOBAL_SECTION.

-----------------------------

Note that the names don't match. And, GLOBAL is a reserved word.

And I thought IBM COBOL was convoluted.

bill


computers / comp.os.vms / Re: COBOL example $MGBLSC

Pages:12
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor