Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

This place just isn't big enough for all of us. We've got to find a way off this planet.


computers / comp.os.vms / COBOL, <gack!> again! Return status.

SubjectAuthor
* COBOL, <gack!> again! Return status.Brian Schenkenberger
+* Re: COBOL, <gack!> again! Return status.bill
|+* Re: COBOL, <gack!> again! Return status.gah4
||`* Re: COBOL, <gack!> again! Return status.Robert A. Brooks
|| `- Re: COBOL, <gack!> again! Return status.gah4
|+- Re: COBOL, <gack!> again! Return status.gah4
|+* Re: COBOL, <gack!> again! Return status.Brian Schenkenberger
||+- Re: COBOL, <gack!> again! Return status.Arne Vajhøj
||`- Re: COBOL, <gack!> again! Return status.bill
|`* Re: COBOL, <gack!> again! Return status.bill
| `* Re: COBOL, <gack!> again! Return status.Chris Townley
|  `* Re: COBOL, <gack!> again! Return status.bill
|   +- Re: COBOL, <gack!> again! Return status.Arne Vajhøj
|   `* Re: COBOL, <gack!> again! Return status.Phil Howell
|    `* Re: COBOL, <gack!> again! Return status.bill
|     `* Re: COBOL, <gack!> again! Return status.Johnny Billquist
|      +- Re: COBOL, <gack!> again! Return status.bill
|      `* Re: COBOL, <gack!> again! Return status.Scott Dorsey
|       `* Re: COBOL, <gack!> again! Return status.Jake Hamby (Solid State Jake)
|        `- Re: COBOL, <gack!> again! Return status.Phil Howell
+* Re: COBOL, <gack!> again! Return status.Arne Vajhøj
|+* Re: COBOL, <gack!> again! Return status.Brian Schenkenberger
||+* Re: COBOL, <gack!> again! Return status.Arne Vajhøj
|||`- Re: COBOL, <gack!> again! Return status.Arne Vajhøj
||`- Re: COBOL, <gack!> again! Return status.bill
|`* Re: COBOL, <gack!> again! Return status.bill
| `- Re: COBOL, <gack!> again! Return status.Brian Schenkenberger
+* Re: COBOL, <gack!> again! Return status.Hein RMS van den Heuvel
|`* Re: COBOL, <gack!> again! Return status.bill
| `* Re: COBOL, <gack!> again! Return status.bill
|  `* Re: COBOL, <gack!> again! Return status.Jan-Erik Söderholm
|   `* Re: COBOL, <gack!> again! Return status.bill
|    +- Re: COBOL, <gack!> again! Return status.abrsvc
|    `- Re: COBOL, <gack!> again! Return status.bill
`* Re: COBOL, <gack!> again! Return status.Stephen Hoffman
 `- Re: COBOL, <gack!> again! Return status.Brian Schenkenberger

Pages:12
COBOL, <gack!> again! Return status.

<udno66$15p49$1@dont-email.me>

  copy mid

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

  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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 15:01:26 -0400
Organization: Tmesis Software
Lines: 7
Message-ID: <udno66$15p49$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="3a0a2dca15f0b935ed08b292fb5f35e8";
logging-data="1238153"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/uV32DeH39ZbicnhamVj9+"
User-Agent: Unison/2.2
Cancel-Lock: sha1:yuHXIfj2e9+IaumZGVp/05TyrB8=
 by: Brian Schenkenberger - Mon, 11 Sep 2023 19:01 UTC

How does a COBOL program return a status (ie. R0) to a calling program?
I found a reference to RETURN-CODE but compiler balks at that.

— VAXman

Re: COBOL, <gack!> again! Return status.

<km993mF8emlU21@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!paganini.bofh.team!2.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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 15:45:56 -0400
Lines: 19
Message-ID: <km993mF8emlU21@mid.individual.net>
References: <udno66$15p49$1@dont-email.me>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net crGA71QEB9x+j99awm7DAgikcfpCZ4ypX1IxsYm0Rv1Yae37l+
Cancel-Lock: sha1:SqMMIkKFNehawBhLyFfJvxZGaj8= sha256:jERF9bHE+8+auYNL6t9OwusRtxpr1yW8CV5QMx2UfeI=
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: <udno66$15p49$1@dont-email.me>
 by: bill - Mon, 11 Sep 2023 19:45 UTC

On 9/11/2023 3:01 PM, Brian Schenkenberger wrote:
> How does a COBOL program return a status (ie. R0) to a calling program?
> I found a reference to RETURN-CODE but compiler balks at that.
>

In Unix ending the program with:

STOP RUN RETURNING {literal-1}
{identifier-1}

will make a return code available to the shell.

If you want a status returned to DCL I expect that would do it.

bill

{I really need to get a VMS system running here again.}

Re: COBOL, <gack!> again! Return status.

<8f3ac14a-31fb-4c55-b366-c8d391985164n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ad4:57d1:0:b0:63f:c154:b92f with SMTP id y17-20020ad457d1000000b0063fc154b92fmr194298qvx.9.1694462034826;
Mon, 11 Sep 2023 12:53:54 -0700 (PDT)
X-Received: by 2002:a63:6b08:0:b0:565:f527:a61c with SMTP id
g8-20020a636b08000000b00565f527a61cmr116831pgc.4.1694462034090; Mon, 11 Sep
2023 12:53:54 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.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: Mon, 11 Sep 2023 12:53:53 -0700 (PDT)
In-Reply-To: <km993mF8emlU21@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:803f:85d3:1a8c:a6b;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:803f:85d3:1a8c:a6b
References: <udno66$15p49$1@dont-email.me> <km993mF8emlU21@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <8f3ac14a-31fb-4c55-b366-c8d391985164n@googlegroups.com>
Subject: Re: COBOL, <gack!> again! Return status.
From: gah...@u.washington.edu (gah4)
Injection-Date: Mon, 11 Sep 2023 19:53:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1620
 by: gah4 - Mon, 11 Sep 2023 19:53 UTC

On Monday, September 11, 2023 at 12:46:03 PM UTC-7, bill wrote:

(snip)

> If you want a status returned to DCL I expect that would do it.

But DCL will give you a funny message, instead of a number.

Years ago, I had a program that returned 8.

For IBM OS/360 and descendents, 8 is error,
(4 is warning, 12 is even worse error).

And then VMS gives a surprising message, that doesn't help at all.

Re: COBOL, <gack!> again! Return status.

<35275a3e-d7ea-4405-9ba1-c32a62331316n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:620a:8b01:b0:76e:fa6a:705b with SMTP id qw1-20020a05620a8b0100b0076efa6a705bmr183462qkn.7.1694462277818;
Mon, 11 Sep 2023 12:57:57 -0700 (PDT)
X-Received: by 2002:a17:903:228b:b0:1c0:bcbc:d55 with SMTP id
b11-20020a170903228b00b001c0bcbc0d55mr4084783plh.5.1694462277631; Mon, 11 Sep
2023 12:57:57 -0700 (PDT)
Path: i2pn2.org!i2pn.org!paganini.bofh.team!2.eu.feeder.erje.net!feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.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: Mon, 11 Sep 2023 12:57:56 -0700 (PDT)
In-Reply-To: <km993mF8emlU21@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:803f:85d3:1a8c:a6b;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:803f:85d3:1a8c:a6b
References: <udno66$15p49$1@dont-email.me> <km993mF8emlU21@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <35275a3e-d7ea-4405-9ba1-c32a62331316n@googlegroups.com>
Subject: Re: COBOL, <gack!> again! Return status.
From: gah...@u.washington.edu (gah4)
Injection-Date: Mon, 11 Sep 2023 19:57:57 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 1702
 by: gah4 - Mon, 11 Sep 2023 19:57 UTC

On Monday, September 11, 2023 at 12:46:03 PM UTC-7, bill wrote:

(snip)

> If you want a status returned to DCL I expect that would do it.

OK, I had to look it up. It seems that 8 give "ACCVIO Access Violation".

Now, it does that even if your program doesn't have any actual access violation.

So I start trying to figure out where my program goes wrong, and then find out why.

Re: COBOL, <gack!> again! Return status.

<udnria$16989$1@dont-email.me>

  copy mid

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

  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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 15:59:05 -0400
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <udnria$16989$1@dont-email.me>
References: <udno66$15p49$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 11 Sep 2023 19:59:07 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="28ca6c9d5c554b433b19a6c64ccf821f";
logging-data="1254665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19u+Dv6mDfni9YVtB0OU4jaWXuFvoL0GIo="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:bL122153iYQCuvIOvVDYy2Imn78=
Content-Language: en-US
In-Reply-To: <udno66$15p49$1@dont-email.me>
 by: Arne Vajhøj - Mon, 11 Sep 2023 19:59 UTC

On 9/11/2023 3:01 PM, Brian Schenkenberger wrote:
> How does a COBOL program return a status (ie. R0) to a calling program?
> I found a reference to RETURN-CODE but compiler balks at that.

Disclaimer: I really don't know Cobol, but the following seems to work:

$ type m.cob
identification division.
program-id.m.
data division.
working-storage section.
01 a pic 9(9) comp.
01 b pic 9(9) comp.
01 res pic 9(9) comp.
01 res2 pic 9(9) display.
procedure division.
main-paragraph.
move 123 to a
move 456 to b
call "ADD2" using a,b giving res
move res to res2
display res2
stop run.
$ cob m
$ type add2.cob
identification division.
program-id.add2.
data division.
working-storage section.
01 res pic 9(9) comp.
linkage section.
01 a pic 9(9) comp.
01 b pic 9(9) comp.
procedure division using a,b giving res.
main-paragraph.
compute res = a + b.
end program add2.
$ cob add2
$ link m + add2
$ run m
000000579

Arne

Re: COBOL, <gack!> again! Return status.

<udnrkc$169vf$1@dont-email.me>

  copy mid

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

  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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 16:00:12 -0400
Organization: Tmesis Software
Lines: 53
Message-ID: <udnrkc$169vf$1@dont-email.me>
References: <udno66$15p49$1@dont-email.me> <km993mF8emlU21@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="3a0a2dca15f0b935ed08b292fb5f35e8";
logging-data="1255407"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX198VJpa3z8XBFVfJTkJyBy4"
User-Agent: Unison/2.2
Cancel-Lock: sha1:UpiUbfiIwp0W6pPL0QHsa0YwJwA=
 by: Brian Schenkenberger - Mon, 11 Sep 2023 20:00 UTC

On 2023-09-11 19:45:56 +0000, bill said:

> On 9/11/2023 3:01 PM, Brian Schenkenberger wrote:
>> How does a COBOL program return a status (ie. R0) to a calling program?
>> I found a reference to RETURN-CODE but compiler balks at that.
>>
>
> In Unix ending the program with:
>
> STOP RUN RETURNING {literal-1}
> {identifier-1}
>
>
> will make a return code available to the shell.
>
> If you want a status returned to DCL I expect that would do it.
>
> bill
>
> {I really need to get a VMS system running here again.}

I need a COBOL sub-program to return a value to its COBOL caller.

PROGRAM-ID. MAIN-PROGRAM.
: :
CALL "ADVENTURE" USING MAGIC-WORDS GIVING MAGIC-SMOKE.
: :
IF MAGIC-SMOKE = SS$_XYZZY THEN
do something and tele-transport out of cave.
END-IF.

Sub-PROGRAM

Then, something like

PROGRAM-ID. ADVENTURE.
: :
PROCEDURE DIVISION USING MAGIC-WORDS RETURNING MAGIC-SMOKE TO CALLER.
-- this is correct syntax up to this point ---------------^
: :
MOVE SS$_XYZZY TO MAGIC-SMOKE.
EXIT.

END PROGRAM ADVENTURE.

— VAXman

Re: COBOL, <gack!> again! Return status.

<udns48$164u5$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: FIRST.L...@vmssoftware.com (Robert A. Brooks)
Newsgroups: comp.os.vms
Subject: Re: COBOL, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 16:08:40 -0400
Organization: A noiseless patient Spider
Lines: 31
Message-ID: <udns48$164u5$1@dont-email.me>
References: <udno66$15p49$1@dont-email.me> <km993mF8emlU21@mid.individual.net>
<8f3ac14a-31fb-4c55-b366-c8d391985164n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 11 Sep 2023 20:08:40 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9c2cfd30dd91579cd13dc4559007aa73";
logging-data="1250245"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+S/+Sa5PF5OeqRRmamPFMsmzqM10RVptSNta50J9P7EQ=="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:ZHf8gXX3yKSAiK6shmg2Cv8nrDk=
X-Antivirus-Status: Clean
In-Reply-To: <8f3ac14a-31fb-4c55-b366-c8d391985164n@googlegroups.com>
X-Antivirus: Avast (VPS 230911-6, 9/11/2023), Outbound message
Content-Language: en-US
 by: Robert A. Brooks - Mon, 11 Sep 2023 20:08 UTC

On 9/11/2023 3:53 PM, gah4 wrote:
> On Monday, September 11, 2023 at 12:46:03 PM UTC-7, bill wrote:
>
> (snip)
>
>> If you want a status returned to DCL I expect that would do it.
>
> But DCL will give you a funny message, instead of a number.
>
> Years ago, I had a program that returned 8.
>
> For IBM OS/360 and descendents, 8 is error,
> (4 is warning, 12 is even worse error).
>
> And then VMS gives a surprising message, that doesn't help at all.

What is surprising about the below messages, and the escalation in their severity?

$ exit 8
%SYSTEM-W-ACCVIO, access violation, reason mask=00, virtual address=0000000000000008, PC=000000007AEE1EA8, PS=00000000
$ exit 10
%SYSTEM-E-ACCVIO, access violation, reason mask=00, virtual address=000000000000000A, PC=000000007AEE1EA8, PS=00000000
$ exit 12
%SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=000000000000000C, PC=000000007AEE1EA8, PS=00000000

$ HELP /MESSAGE ACCVIO will explain the above.

--
-- Rob

Re: COBOL, <gack!> again! Return status.

<udns81$16989$2@dont-email.me>

  copy mid

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

  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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 16:10:41 -0400
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <udns81$16989$2@dont-email.me>
References: <udno66$15p49$1@dont-email.me> <km993mF8emlU21@mid.individual.net>
<udnrkc$169vf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 11 Sep 2023 20:10:41 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="28ca6c9d5c554b433b19a6c64ccf821f";
logging-data="1254665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/8NSzoqG6AfYfhOKN/4lrfIvcMdyWHkVo="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:B4oEl1OELIvCSkAwe3RLS8Z5A1c=
Content-Language: en-US
In-Reply-To: <udnrkc$169vf$1@dont-email.me>
 by: Arne Vajhøj - Mon, 11 Sep 2023 20:10 UTC

On 9/11/2023 4:00 PM, Brian Schenkenberger wrote:
> I need a COBOL sub-program to return a value to its COBOL caller.
>
> PROGRAM-ID.        MAIN-PROGRAM.
> :
> CALL "ADVENTURE" USING MAGIC-WORDS GIVING MAGIC-SMOKE.
> :
> IF MAGIC-SMOKE = SS$_XYZZY THEN
>     do something and tele-transport out of cave.
> END-IF.

> PROGRAM-ID.     ADVENTURE.
> :
> :
> PROCEDURE DIVISION USING MAGIC-WORDS RETURNING MAGIC-SMOKE TO CALLER.
> -- this is correct syntax up to this point ---------------^

PROCEDURE DIVISION USING MAGIC-WORDS GIVING MAGIC-SMOKE

> :
>     MOVE SS$_XYZZY TO MAGIC-SMOKE.
>         EXIT.
>
> END PROGRAM ADVENTURE.

Also see the little ADD example I posted.

The args goes in linkage section the result goes in
working-storage section.

Arne

Re: COBOL, <gack!> again! Return status.

<km9aj9F8emnU14@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 16:11:19 -0400
Lines: 59
Message-ID: <km9aj9F8emnU14@mid.individual.net>
References: <udno66$15p49$1@dont-email.me> <km993mF8emlU21@mid.individual.net>
<udnrkc$169vf$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 UxXTQvx47G13xY1heRcFjgBzOjnxdh9xfdQqpb6NjyS3LirfW+
Cancel-Lock: sha1:y5gv+l799SAl35HmgP8gNS0/et4= sha256:b4GS5T/Zo5IB1IPQbmi/rMSyACcKwzBGjkmoGwVHICo=
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: <udnrkc$169vf$1@dont-email.me>
 by: bill - Mon, 11 Sep 2023 20:11 UTC

On 9/11/2023 4:00 PM, Brian Schenkenberger wrote:
> On 2023-09-11 19:45:56 +0000, bill said:
>
>> On 9/11/2023 3:01 PM, Brian Schenkenberger wrote:
>>> How does a COBOL program return a status (ie. R0) to a calling
>>> program? I found a reference to RETURN-CODE but compiler balks at that.
>>>
>>
>> In Unix ending the program with:
>>
>>      STOP RUN RETURNING {literal-1}
>>                         {identifier-1}
>>
>>
>> will make a return code available to the shell.
>>
>> If you want a status returned to DCL I expect that would do it.
>>
>> bill
>>
>> {I really need to get a VMS system running here again.}
>
> I need a COBOL sub-program to return a value to its COBOL caller.
>
> PROGRAM-ID.        MAIN-PROGRAM.
> :
> :
> CALL "ADVENTURE" USING MAGIC-WORDS GIVING MAGIC-SMOKE.
> :
> :
> IF MAGIC-SMOKE = SS$_XYZZY THEN
>     do something and tele-transport out of cave.
> END-IF.
>
>
>
> Sub-PROGRAM
>
> Then, something like
>
> PROGRAM-ID.     ADVENTURE.
> :
> :
> PROCEDURE DIVISION USING MAGIC-WORDS RETURNING MAGIC-SMOKE TO CALLER.
> -- this is correct syntax up to this point ---------------^
> :
> :
>     MOVE SS$_XYZZY TO MAGIC-SMOKE.
>         EXIT.
>
> END PROGRAM ADVENTURE.
>
> — VAXman
>

OK, give a couple minutes. :-)

bill

Re: COBOL, <gack!> again! Return status.

<udnsbc$16dl6$1@dont-email.me>

  copy mid

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

  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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 16:12:28 -0400
Organization: Tmesis Software
Lines: 58
Message-ID: <udnsbc$16dl6$1@dont-email.me>
References: <udno66$15p49$1@dont-email.me> <udnria$16989$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="3a0a2dca15f0b935ed08b292fb5f35e8";
logging-data="1259174"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18EtCVQUk+FR3sYcgQw0jKG"
User-Agent: Unison/2.2
Cancel-Lock: sha1:W4jvxKv43HVqlKTiOS3SBWFk9Tg=
 by: Brian Schenkenberger - Mon, 11 Sep 2023 20:12 UTC

On 2023-09-11 19:59:05 +0000, Arne Vajhj said:

> On 9/11/2023 3:01 PM, Brian Schenkenberger wrote:
>> How does a COBOL program return a status (ie. R0) to a calling program?
>> I found a reference to RETURN-CODE but compiler balks at that.
>
> Disclaimer: I really don't know Cobol, but the following seems to work:
>
> $ type m.cob
> identification division.
> program-id.m.
> data division.
> working-storage section.
> 01 a pic 9(9) comp.
> 01 b pic 9(9) comp.
> 01 res pic 9(9) comp.
> 01 res2 pic 9(9) display.
> procedure division.
> main-paragraph.
> move 123 to a
> move 456 to b
> call "ADD2" using a,b giving res
> move res to res2
> display res2
> stop run.
> $ cob m
> $ type add2.cob
> identification division.
> program-id.add2.
> data division.
> working-storage section.
> 01 res pic 9(9) comp.
> linkage section.
> 01 a pic 9(9) comp.
> 01 b pic 9(9) comp.
> procedure division using a,b giving res.
> main-paragraph.
> compute res = a + b.
> end program add2.
> $ cob add2
> $ link m + add2
> $ run m
> 000000579
>
> Arne

I've tried that but compiler pukes on it. I've tried:

MOVE SS$_NORMAL TO RES.

and

COMPUTE RES = SS$_NORMAL *1.

It just doesn't like it.

—VAXman

Re: COBOL, <gack!> again! Return status.

<km9aruF8emnU15@mid.individual.net>

  copy mid

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

  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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 16:15:56 -0400
Lines: 50
Message-ID: <km9aruF8emnU15@mid.individual.net>
References: <udno66$15p49$1@dont-email.me> <udnria$16989$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 V9wX5RLqty/ZmSKXeOD0ugeSRJwrNNmtCps2D5OGYZfUXbxt8M
Cancel-Lock: sha1:D/JguEi5OC388EyL0yDBzb0qhWc= sha256:e3jcjHh1QPQVRCXM6Jp8AN3Go68Umg8v1uP0tss4aBM=
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: <udnria$16989$1@dont-email.me>
 by: bill - Mon, 11 Sep 2023 20:15 UTC

On 9/11/2023 3:59 PM, Arne Vajhøj wrote:
> On 9/11/2023 3:01 PM, Brian Schenkenberger wrote:
>> How does a COBOL program return a status (ie. R0) to a calling
>> program? I found a reference to RETURN-CODE but compiler balks at that.
>
> Disclaimer: I really don't know Cobol, but the following seems to work:
>
> $ type m.cob
> identification division.
> program-id.m.
> data division.
> working-storage section.
> 01  a       pic 9(9) comp.
> 01  b       pic 9(9) comp.
> 01  res     pic 9(9) comp.
> 01  res2    pic 9(9) display.
> procedure division.
> main-paragraph.
>     move 123 to a
>     move 456 to b
>     call "ADD2" using a,b giving res
>     move res to res2
>     display res2
>     stop run.
> $ cob m
> $ type add2.cob
> identification division.
> program-id.add2.
> data division.
> working-storage section.
> 01  res     pic 9(9) comp.
> linkage section.
> 01  a       pic 9(9) comp.
> 01  b       pic 9(9) comp.
> procedure division using a,b giving res.
> main-paragraph.
>     compute res = a + b.
>     end program add2.
> $ cob add2
> $ link m + add2
> $ run m
> 000000579
>

Yeah, that should do the trick. I prefer to use RETURNING rather than
GIVING but that's just a human readability thing for me.

bill

Re: COBOL, <gack!> again! Return status.

<udnskc$16989$3@dont-email.me>

  copy mid

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

  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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 16:17:16 -0400
Organization: A noiseless patient Spider
Lines: 34
Message-ID: <udnskc$16989$3@dont-email.me>
References: <udno66$15p49$1@dont-email.me> <udnria$16989$1@dont-email.me>
<udnsbc$16dl6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 11 Sep 2023 20:17:16 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="28ca6c9d5c554b433b19a6c64ccf821f";
logging-data="1254665"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/D1kqvysri38P1swmBXx0XGgkL7A5pfB8="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:if30MqmUlPN+vx8GjGzBSwl4jww=
Content-Language: en-US
In-Reply-To: <udnsbc$16dl6$1@dont-email.me>
 by: Arne Vajhøj - Mon, 11 Sep 2023 20:17 UTC

On 9/11/2023 4:12 PM, Brian Schenkenberger wrote:
> On 2023-09-11 19:59:05 +0000, Arne Vajhj said:
>> $ type add2.cob
>> identification division.
>> program-id.add2.
>> data division.
>> working-storage section.
>> 01  res     pic 9(9) comp.
>> linkage section.
>> 01  a       pic 9(9) comp.
>> 01  b       pic 9(9) comp.
>> procedure division using a,b giving res.
>> main-paragraph.
>>      compute res = a + b.
>>      end program add2.

> I've tried that but compiler pukes on it.  I've tried:
>
> MOVE SS$_NORMAL TO RES.
>
> and
>
> COMPUTE RES = SS$_NORMAL *1.
>
> It just doesn't like it.

Move should be fine.

How did you declare RES and how did you declare SS$_NORMAL and
what error did you get?

Arne

Re: COBOL, <gack!> again! Return status.

<udnt2j$169gn$2@dont-email.me>

  copy mid

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

  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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 16:24:51 -0400
Organization: A noiseless patient Spider
Lines: 78
Message-ID: <udnt2j$169gn$2@dont-email.me>
References: <udno66$15p49$1@dont-email.me> <udnria$16989$1@dont-email.me>
<udnsbc$16dl6$1@dont-email.me> <udnskc$16989$3@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 11 Sep 2023 20:24:51 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="28ca6c9d5c554b433b19a6c64ccf821f";
logging-data="1254935"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18MQDdwvG45xNiaEqNliPLtrJGCbqD/f5Y="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:LTnzzoMo5psORCFTaLPlJ1J8zfk=
In-Reply-To: <udnskc$16989$3@dont-email.me>
Content-Language: en-US
 by: Arne Vajhøj - Mon, 11 Sep 2023 20:24 UTC

On 9/11/2023 4:17 PM, Arne Vajhøj wrote:
> On 9/11/2023 4:12 PM, Brian Schenkenberger wrote:
>> On 2023-09-11 19:59:05 +0000, Arne Vajhj said:
>>> $ type add2.cob
>>> identification division.
>>> program-id.add2.
>>> data division.
>>> working-storage section.
>>> 01  res     pic 9(9) comp.
>>> linkage section.
>>> 01  a       pic 9(9) comp.
>>> 01  b       pic 9(9) comp.
>>> procedure division using a,b giving res.
>>> main-paragraph.
>>>      compute res = a + b.
>>>      end program add2.
>
>> I've tried that but compiler pukes on it.  I've tried:
>>
>> MOVE SS$_NORMAL TO RES.
>>
>> and
>>
>> COMPUTE RES = SS$_NORMAL *1.
>>
>> It just doesn't like it.
>
> Move should be fine.
>
> How did you declare RES and how did you declare SS$_NORMAL and
> what error did you get?

Anyway.

$ typ m2.cob
identification division.
program-id.m.
data division.
working-storage section.
01 a pic 9(9) comp.
01 b pic 9(9) comp.
01 res pic 9(9) comp.
01 stat pic 9(9) comp.
01 res2 pic 9(9) display.
01 stat2 pic 9(9) display.
procedure division.
main-paragraph.
move 123 to a
move 456 to b
call "ADD3" using a,b,res giving stat
move res to res2
move stat to stat2
display stat2 " " res2
stop run.
$ cob m2
$ type add3.cob
identification division.
program-id.add3.
data division.
working-storage section.
01 SS$_NORMAL pic 9(9) comp value is external SS$_NORMAL.
01 stat pic 9(9) comp.
linkage section.
01 a pic 9(9) comp.
01 b pic 9(9) comp.
01 res pic 9(9) comp.
procedure division using a,b,res giving stat.
main-paragraph.
compute res = a + b
move SS$_NORMAL to stat.
end program add3.
$ cob add3
$ link m2 + add3
$ run m2
000000001 000000579

Arne

Re: COBOL, <gack!> again! Return status.

<1fe70dd2-22c1-4719-97d0-7135b62cc9bdn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:620a:2096:b0:76d:7b5d:d4c9 with SMTP id e22-20020a05620a209600b0076d7b5dd4c9mr173294qka.7.1694464617097;
Mon, 11 Sep 2023 13:36:57 -0700 (PDT)
X-Received: by 2002:ac8:7dc3:0:b0:40f:e0dd:8050 with SMTP id
c3-20020ac87dc3000000b0040fe0dd8050mr15093qte.5.1694464616883; Mon, 11 Sep
2023 13:36:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.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: Mon, 11 Sep 2023 13:36:56 -0700 (PDT)
In-Reply-To: <udns48$164u5$1@dont-email.me>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:602:9700:4689:803f:85d3:1a8c:a6b;
posting-account=gLDX1AkAAAA26M5HM-O3sVMAXdxK9FPA
NNTP-Posting-Host: 2601:602:9700:4689:803f:85d3:1a8c:a6b
References: <udno66$15p49$1@dont-email.me> <km993mF8emlU21@mid.individual.net>
<8f3ac14a-31fb-4c55-b366-c8d391985164n@googlegroups.com> <udns48$164u5$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <1fe70dd2-22c1-4719-97d0-7135b62cc9bdn@googlegroups.com>
Subject: Re: COBOL, <gack!> again! Return status.
From: gah...@u.washington.edu (gah4)
Injection-Date: Mon, 11 Sep 2023 20:36:57 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2392
 by: gah4 - Mon, 11 Sep 2023 20:36 UTC

On Monday, September 11, 2023 at 1:08:43 PM UTC-7, Robert A. Brooks wrote:

(snip)

> What is surprising about the below messages, and the escalation in their severity?
> $ exit 8
> %SYSTEM-W-ACCVIO, access violation, reason mask=00, virtual address=0000000000000008, PC=000000007AEE1EA8, PS=00000000
> $ exit 10
> %SYSTEM-E-ACCVIO, access violation, reason mask=00, virtual address=000000000000000A, PC=000000007AEE1EA8, PS=00000000
> $ exit 12
> %SYSTEM-F-ACCVIO, access violation, reason mask=00, virtual address=000000000000000C, PC=000000007AEE1EA8, PS=00000000
It was a C program that I wrote, and that had exit(8); in it.

There was no access violation.

Well, even more, the program does a lot of array access, and I had for a while
been tracking down array bounds problems. Though most were fixed by then,
it is possible that there were some left. But that is my first thought.

> $ HELP /MESSAGE ACCVIO will explain the above.

I suppose it helps if someone else wrote the program.

Re: COBOL, <gack!> again! Return status.

<km9d4rF8emnU16@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!paganini.bofh.team!2.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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 16:54:49 -0400
Lines: 101
Message-ID: <km9d4rF8emnU16@mid.individual.net>
References: <udno66$15p49$1@dont-email.me> <udnria$16989$1@dont-email.me>
<udnsbc$16dl6$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 JJ3izWmklk1657ggznQAXg0pShQo3gXqRdWy59erNS8R6WnJek
Cancel-Lock: sha1:UKHf8Bcb0NjzfDws4bQut5YWTnk= sha256:+7HiWjwwlZWqmn5P8uuKR273znfKxahMYaIVEdaSl30=
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: <udnsbc$16dl6$1@dont-email.me>
 by: bill - Mon, 11 Sep 2023 20:54 UTC

On 9/11/2023 4:12 PM, Brian Schenkenberger wrote:
> On 2023-09-11 19:59:05 +0000, Arne Vajhj said:
>
>> On 9/11/2023 3:01 PM, Brian Schenkenberger wrote:
>>> How does a COBOL program return a status (ie. R0) to a calling
>>> program? I found a reference to RETURN-CODE but compiler balks at that.
>>
>> Disclaimer: I really don't know Cobol, but the following seems to work:
>>
>> $ type m.cob
>> identification division.
>> program-id.m.
>> data division.
>> working-storage section.
>> 01  a       pic 9(9) comp.
>> 01  b       pic 9(9) comp.
>> 01  res     pic 9(9) comp.
>> 01  res2    pic 9(9) display.
>> procedure division.
>> main-paragraph.
>>      move 123 to a
>>      move 456 to b
>>      call "ADD2" using a,b giving res
>>      move res to res2
>>      display res2
>>      stop run.
>> $ cob m
>> $ type add2.cob
>> identification division.
>> program-id.add2.
>> data division.
>> working-storage section.
>> 01  res     pic 9(9) comp.
>> linkage section.
>> 01  a       pic 9(9) comp.
>> 01  b       pic 9(9) comp.
>> procedure division using a,b giving res.
>> main-paragraph.
>>      compute res = a + b.
>>      end program add2.
>> $ cob add2
>> $ link m + add2
>> $ run m
>> 000000579
>>
>> Arne
>
> I've tried that but compiler pukes on it.  I've tried:
>
> MOVE SS$_NORMAL TO RES.
>
> and
>
> COMPUTE RES = SS$_NORMAL *1.
>
> It just doesn't like it.
>
> —VAXman
>

OK Brian, here's a solution to your problem.

identification division.
program-id.m.
data division.
working-storage section.
01 a pic 9(9) comp.
01 b pic 9(9) comp.
01 res pic 9(9) comp.
01 res2 pic 9(9) display.
procedure division.
main-paragraph.
move 123 to a
move 456 to b
call "add2" using a,b,res
move res to res2
display res2
stop run.

identification division.
program-id.add2.
data division.
linkage section.
01 res pic 9(9) comp.
01 a pic 9(9) comp.
01 b pic 9(9) comp.
procedure division using a,b,res.
main-paragraph.
compute res = a + b.
end program add2.

Notice that rather than using the RETURNING|GIVING part this program
just uses another argument to bring back the return value. This works
because all of the arguments are BY REFERENCE.

I intend to look deeper into why the RETURNING is exhibiting strange
behavior but in the meantime this will get the job done and according
to what I just read is considered normal practice for COBOL CALLs.

bill

Re: COBOL, <gack!> again! Return status.

<76750bc2-a323-448d-92db-a418418b82a3n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:ac8:7f45:0:b0:40f:dc70:fdc9 with SMTP id g5-20020ac87f45000000b0040fdc70fdc9mr273909qtk.13.1694478174927;
Mon, 11 Sep 2023 17:22:54 -0700 (PDT)
X-Received: by 2002:a05:6214:8eb:b0:649:90b5:69a0 with SMTP id
dr11-20020a05621408eb00b0064990b569a0mr212162qvb.6.1694478174657; Mon, 11 Sep
2023 17:22:54 -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: Mon, 11 Sep 2023 17:22:54 -0700 (PDT)
In-Reply-To: <udno66$15p49$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: <udno66$15p49$1@dont-email.me>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <76750bc2-a323-448d-92db-a418418b82a3n@googlegroups.com>
Subject: Re: COBOL, <gack!> again! Return status.
From: heinvand...@gmail.com (Hein RMS van den Heuvel)
Injection-Date: Tue, 12 Sep 2023 00:22:54 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2587
 by: Hein RMS van den Heu - Tue, 12 Sep 2023 00:22 UTC

On Monday, September 11, 2023 at 3:01:30 PM UTC-4, Brian Schenkenberger wrote:
> How does a COBOL program return a status (ie. R0) to a calling program?
> I found a reference to RETURN-CODE but compiler balks at that.
>
> — VAXman

Darn novices. Gotta teach them everything.
You should know better than to write 'balks' when asking for help.
What if a customer wrote that to you: "What are you doing EXACTLY, and what message do you get EXACTLY?"

Anyhoo... I largely answered that question in your earlier topic. See summary below.
Admittedly that topic got heavily side-tracked by the usual suspects (par for the course) to Fortran, dashes and underscores. No Emacs reference though, not yet, that's good.

On Friday, September 8, 2023 at 9:02:59 PM UTC-4, Hein RMS van den Heuvel wrote:
> 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.:
: > 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!

Re: COBOL, <gack!> again! Return status.

<km9vabF8emlU22@mid.individual.net>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.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, <gack!> again! Return status.
Date: Mon, 11 Sep 2023 22:04:57 -0400
Lines: 44
Message-ID: <km9vabF8emlU22@mid.individual.net>
References: <udno66$15p49$1@dont-email.me>
<76750bc2-a323-448d-92db-a418418b82a3n@googlegroups.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net z0HPEyTggSJq7qkZh5guFgQP8WX5JoHkxxnaTmF3gtYfVW12kd
Cancel-Lock: sha1:59QROyCdU0xCVuabGr0C+t9pEMA= sha256:VDJC5LsHjK7wFmuETFmH7gex95h1Wi7UeP7t5CV33cA=
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: <76750bc2-a323-448d-92db-a418418b82a3n@googlegroups.com>
 by: bill - Tue, 12 Sep 2023 02:04 UTC

And here is the definitive answer. And based on how convoluted
it seems I can understand why the method I provide in my last
example is considered the better way and none of the numerous
COBOL books (including Murach!) even mention it. But it does
work. Another advantage of the other way is you can actually
return more than one value.

bill

identification division.
program-id.m.
data division.
working-storage section.
01 a pic 9(9) comp.
01 b pic 9(9) comp.
01 res pic 9(9) comp.
01 res2 pic 9(9) display.
procedure division.
main-paragraph.
move 123 to a
move 456 to b
call "add2" using a,b RETURNING res.
move res to res2
display res2
stop run.

identification division.
program-id.add2.
data division.
working-storage section.
01 res pic 9(9) comp.
linkage section.
01 a pic 9(9) comp.
01 b pic 9(9) comp.
procedure division using a,b.
main-paragraph.
compute res = a + b.
move res to RETURN-CODE.
end program add2.

Re: COBOL, <gack!> again! Return status.

<kmb3obF8emnU17@mid.individual.net>

  copy mid

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

  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, <gack!> again! Return status.
Date: Tue, 12 Sep 2023 08:26:49 -0400
Lines: 61
Message-ID: <kmb3obF8emnU17@mid.individual.net>
References: <udno66$15p49$1@dont-email.me>
<76750bc2-a323-448d-92db-a418418b82a3n@googlegroups.com>
<km9vabF8emlU22@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net wg7RVVMiQFBVdBS0T1sumAFEebrsKaVdSX3h0q7oqJaCGYJtS6
Cancel-Lock: sha1:w+f8BLFfOezrC7lXAv/mNvsZUJ8= sha256:LcEWMCn73U31+3uAed/nichAgggwQtlrwrmpPi9541Y=
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: <km9vabF8emlU22@mid.individual.net>
 by: bill - Tue, 12 Sep 2023 12:26 UTC

On 9/11/2023 10:04 PM, bill wrote:
>
>
> And here is the definitive answer.  And based on how convoluted
> it seems I can understand why the method I provide in my last
> example is considered the better way and none of the numerous
> COBOL books (including Murach!) even mention it.  But it does
> work.  Another advantage of the other way is you can actually
> return more than one value.
>
> bill
>
>
> identification division.
> program-id.m.
> data division.
> working-storage section.
> 01  a       pic 9(9) comp.
> 01  b       pic 9(9) comp.
> 01  res     pic 9(9) comp.
> 01  res2    pic 9(9) display.
> procedure division.
> main-paragraph.
>      move 123 to a
>      move 456 to b
>      call "add2" using a,b RETURNING res.
>      move res to res2
>      display res2
>      stop run.
>
> identification division.
> program-id.add2.
> data division.
> working-storage section.
> 01  res     pic 9(9) comp.
> linkage section.
> 01  a       pic 9(9) comp.
> 01  b       pic 9(9) comp.
> procedure division using a,b.
> main-paragraph.
>      compute res = a + b.
>      move res to RETURN-CODE.
>      end program add2.
>
>

And, just to throw another monkey wrench into the works,
I read the VA COBOL Reference and the VSI OpenVMS COBOL
Reference and it appears that VMS COBOL does not even
support RETURNING/GIVING in call statements so the example
above will probably not even compile. But, the previous
example provided should work fine and seems to be the way
VMS expects it to be done. Hope it helps, Brian.

bill

[Anybody else got some COBOL that needs fixin? I still
love this stuff.]

Re: COBOL, <gack!> again! Return status.

<udpmev$1i7pf$1@dont-email.me>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: jan-erik...@telia.com (Jan-Erik Söderholm)
Newsgroups: comp.os.vms
Subject: Re: COBOL, <gack!> again! Return status.
Date: Tue, 12 Sep 2023 14:44:14 +0200
Organization: A noiseless patient Spider
Lines: 28
Message-ID: <udpmev$1i7pf$1@dont-email.me>
References: <udno66$15p49$1@dont-email.me>
<76750bc2-a323-448d-92db-a418418b82a3n@googlegroups.com>
<km9vabF8emlU22@mid.individual.net> <kmb3obF8emnU17@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 12 Sep 2023 12:44:15 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="56a4cfe8a12c72c9e6ae35f2530dddc7";
logging-data="1646383"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/XN+QegfXD96H/whcJJgNy"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.12.0
Cancel-Lock: sha1:IXF4+WcdfR9NlBCKzi5GmSoPd5E=
Content-Language: sv
In-Reply-To: <kmb3obF8emnU17@mid.individual.net>
 by: Jan-Erik Söderholm - Tue, 12 Sep 2023 12:44 UTC

Den 2023-09-12 kl. 14:26, skrev bill:

> I read the VA COBOL Reference and the VSI OpenVMS COBOL
> Reference and it appears that VMS COBOL does not even
> support RETURNING/GIVING in call statements...

My copy of "VSI OpenVMS VSI COBOL Reference Guide" says
on page 275, in the description of the CALL statement:

22.
On Alpha and I64 systems, if the GIVING phrase of the CALL
statement is not specified, the function result is made available
in the RETURN-CODE special register when control returns to the
calling program.

23.
If the GIVING phrase is specified, the function result is made
available in function-res when control returns to the calling program.

[function-res]
Is the identifier of an elementary integer numeric data item with COMP,
COMP-1, or COMP-2 usage and no scaling positions. function-res can be
subscripted, and it can be qualified. When control returns to the calling
program, function-res can contain a function result.

I would not expected that to be any different on x86...

Re: COBOL, <gack!> again! Return status.

<kmb5njF8emlU23@mid.individual.net>

  copy mid

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

  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, <gack!> again! Return status.
Date: Tue, 12 Sep 2023 09:00:32 -0400
Lines: 46
Message-ID: <kmb5njF8emlU23@mid.individual.net>
References: <udno66$15p49$1@dont-email.me>
<76750bc2-a323-448d-92db-a418418b82a3n@googlegroups.com>
<km9vabF8emlU22@mid.individual.net> <kmb3obF8emnU17@mid.individual.net>
<udpmev$1i7pf$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 SOi68zFhpAYECaK19NPVKAotw0sNTxSRKqKYJhAUrg1/7/dpDx
Cancel-Lock: sha1:wRTLFoaKMJ+rsx7loVqJPnOe/VA= sha256:zn3fL+ViFZKMdbN3uciK4KR9KjpueTyvXXhQyoCNOAo=
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: <udpmev$1i7pf$1@dont-email.me>
 by: bill - Tue, 12 Sep 2023 13:00 UTC

On 9/12/2023 8:44 AM, Jan-Erik Söderholm wrote:
> Den 2023-09-12 kl. 14:26, skrev bill:
>
>> I read the VA COBOL Reference and the VSI OpenVMS COBOL
>> Reference and it appears that VMS COBOL does not even
>> support RETURNING/GIVING in call statements...
>
> My copy of "VSI OpenVMS VSI COBOL Reference Guide" says
> on page 275, in the description of the CALL statement:
>
> 22.
> On Alpha and I64 systems, if the GIVING phrase of the CALL
> statement is not specified, the function result is made available
> in the RETURN-CODE special register when control returns to the
> calling program.
>
> 23.
> If the GIVING phrase is specified, the function result is made
> available in function-res when control returns to the calling program.
>
> [function-res]
> Is the identifier of an elementary integer numeric data item with COMP,
> COMP-1, or COMP-2 usage and no scaling positions. function-res can be
> subscripted, and it can be qualified. When control returns to the calling
> program, function-res can contain a function result.
>
>
>
> I would not expected that to be any different on x86...

Wow, I found and read that section. Seems to have been done as an
after thought. I guess the reason some compilers haven't included
it is because of the X/Open qualifier. :-) The explanation is even
more confusing than the one I finally found that made my last example
possible. In mine, the programmer has to put a value in RETURN-CODE
which then gets passed back to the RETURNING/GIVING identifier. The
VMS Reference seems to hint that it some how shows up in RETURN-CODE
automatically.

Could someone with the necessary compiler test my last example and
let me know if it works on VMS? Looks like setting up a VAX isn't
the answer. I wonder if the problems I had with the Alpha emulator
were ever fixed?

bill

Re: COBOL, <gack!> again! Return status.

<6c03437c-12b8-4a06-a468-3edd79a6119en@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.os.vms
X-Received: by 2002:a05:622a:181b:b0:412:26be:464f with SMTP id t27-20020a05622a181b00b0041226be464fmr320414qtc.7.1694533219790;
Tue, 12 Sep 2023 08:40:19 -0700 (PDT)
X-Received: by 2002:a17:90b:796:b0:268:8e93:6459 with SMTP id
l22-20020a17090b079600b002688e936459mr3491092pjz.8.1694533219214; Tue, 12 Sep
2023 08:40:19 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!newsfeed.hasname.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.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: Tue, 12 Sep 2023 08:40:18 -0700 (PDT)
In-Reply-To: <kmb5njF8emlU23@mid.individual.net>
Injection-Info: google-groups.googlegroups.com; posting-host=2600:4040:5ed8:3d00:81c4:733b:30d5:2483;
posting-account=Ysq9BAoAAACGX1EcMMPkdNg4YcTg0TxG
NNTP-Posting-Host: 2600:4040:5ed8:3d00:81c4:733b:30d5:2483
References: <udno66$15p49$1@dont-email.me> <76750bc2-a323-448d-92db-a418418b82a3n@googlegroups.com>
<km9vabF8emlU22@mid.individual.net> <kmb3obF8emnU17@mid.individual.net>
<udpmev$1i7pf$1@dont-email.me> <kmb5njF8emlU23@mid.individual.net>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <6c03437c-12b8-4a06-a468-3edd79a6119en@googlegroups.com>
Subject: Re: COBOL, <gack!> again! Return status.
From: dansabrs...@yahoo.com (abrsvc)
Injection-Date: Tue, 12 Sep 2023 15:40:19 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1876
 by: abrsvc - Tue, 12 Sep 2023 15:40 UTC

> Could someone with the necessary compiler test my last example and
> let me know if it works on VMS? Looks like setting up a VAX isn't
> the answer. I wonder if the problems I had with the Alpha emulator
> were ever fixed?
>
> bill

Bill,

A bit off topic, but please create a new topic re: I wonder if the problems I had with the Alpha emulator were ever fixed?

Please describe the problem. Perhaps it has been fixed...

Dan

Disclosure: I work for Stromasys, the source of the Charon series of emulation products.

Re: COBOL, <gack!> again! Return status.

<udq413$1ktj8$1@dont-email.me>

  copy mid

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

  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, <gack!> again! Return status.
Date: Tue, 12 Sep 2023 12:35:47 -0400
Organization: Tmesis Software
Lines: 5
Message-ID: <udq413$1ktj8$1@dont-email.me>
References: <udno66$15p49$1@dont-email.me> <udnria$16989$1@dont-email.me> <km9aruF8emnU15@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: dont-email.me; posting-host="efce425faf2b5ece969535c4f460b133";
logging-data="1734248"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/S6oPTpZn+//FLFxH3m/iw"
User-Agent: Unison/2.2
Cancel-Lock: sha1:DAdxF0AU887ahs++EOljglwKenI=
 by: Brian Schenkenberger - Tue, 12 Sep 2023 16:35 UTC

FYI, I found a stray . in an IF statement that cause the compile to
balk when trying this return status thing.

— VAXman

Re: COBOL, <gack!> again! Return status.

<kmbn7uF8emnU18@mid.individual.net>

  copy mid

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

  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, <gack!> again! Return status.
Date: Tue, 12 Sep 2023 13:59:23 -0400
Lines: 15
Message-ID: <kmbn7uF8emnU18@mid.individual.net>
References: <udno66$15p49$1@dont-email.me>
<76750bc2-a323-448d-92db-a418418b82a3n@googlegroups.com>
<km9vabF8emlU22@mid.individual.net> <kmb3obF8emnU17@mid.individual.net>
<udpmev$1i7pf$1@dont-email.me> <kmb5njF8emlU23@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net eewisq7F9rcYA6rO0ntexg25ka/OWqeDWvr7RLqOKkgr5U7cx5
Cancel-Lock: sha1:Jwh7qJNKjYlIZhJnwI1HW2pkwxs= sha256:t+CyP2i3ofAwMxYTpJ33IxBE+Ix5Z6tqdzbNWsxjTao=
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: <kmb5njF8emlU23@mid.individual.net>
 by: bill - Tue, 12 Sep 2023 17:59 UTC

One last comment on this project.

I installed the Student System and was able to test my code
myself.

Had to change RETURNING to GIVING as it appears VMS COBOL
doesn't support the use of RETURNING. Other than that it
worked fine.

But I still say the other way is probably better and will
definitely result in more readable code.

bill

Re: COBOL, <gack!> again! Return status.

<kmhg06Fcg06U1@mid.individual.net>

  copy mid

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

  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, <gack!> again! Return status.
Date: Thu, 14 Sep 2023 18:32:37 -0400
Lines: 37
Message-ID: <kmhg06Fcg06U1@mid.individual.net>
References: <udno66$15p49$1@dont-email.me> <km993mF8emlU21@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: individual.net bgmGXM6CcFgLtbQuxSnB5gnEPj3NloCJ4CJJpyHfICn51/tiIm
Cancel-Lock: sha1:97kS6SalN40OQYEy5IdVsPWliMc= sha256:PsxjEESLQV90iP9ENZqKOO+FjqqhykO5//IxXH4qk2g=
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Content-Language: en-US
In-Reply-To: <km993mF8emlU21@mid.individual.net>
 by: bill - Thu, 14 Sep 2023 22:32 UTC

On 9/11/2023 3:45 PM, bill wrote:
> On 9/11/2023 3:01 PM, Brian Schenkenberger wrote:
>> How does a COBOL program return a status (ie. R0) to a calling
>> program? I found a reference to RETURN-CODE but compiler balks at that.
>>
>
> In Unix ending the program with:
>
>     STOP RUN RETURNING {literal-1}
>                        {identifier-1}
>
>
> will make a return code available to the shell.
>
> If you want a status returned to DCL I expect that would do it.
>
> bill
>
> {I really need to get a VMS system running here again.}
>

OK, in case anyone is still interested in any of this.

OpenVMS COBOL does not support the RETURNING clause on a STOP RUN.

If you wish to pass a STATUS back to DCL you have to put the
desired value in the predefined variable RETURN-CODE before
using STOP RUN.

I tried it and it works fine.

I really miss doing COBOL. Kinda miss Fortran, too, but not
as much. And then there was Pascal. A shame we lost all the
good languages.

bill

Re: COBOL, <gack!> again! Return status.

<ue0418$2ss52$1@dont-email.me>

  copy mid

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

  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, <gack!> again! Return status.
Date: Fri, 15 Sep 2023 00:12:40 +0100
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <ue0418$2ss52$1@dont-email.me>
References: <udno66$15p49$1@dont-email.me> <km993mF8emlU21@mid.individual.net>
<kmhg06Fcg06U1@mid.individual.net>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 14 Sep 2023 23:12:40 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="7cc4db7204ca4ff277b1f7a39ce6da6e";
logging-data="3043490"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Q9eqBxdQ/myXOIFSOSidMlpoOG+uY3lk="
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.1
Cancel-Lock: sha1:zIvAaK+ZOH+Zl9HI1Vv5N4TMf78=
Content-Language: en-GB
In-Reply-To: <kmhg06Fcg06U1@mid.individual.net>
 by: Chris Townley - Thu, 14 Sep 2023 23:12 UTC

On 14/09/2023 23:32, bill wrote:
> On 9/11/2023 3:45 PM, bill wrote:
>> On 9/11/2023 3:01 PM, Brian Schenkenberger wrote:
>>> How does a COBOL program return a status (ie. R0) to a calling
>>> program? I found a reference to RETURN-CODE but compiler balks at that.
>>>
>>
>> In Unix ending the program with:
>>
>>      STOP RUN RETURNING {literal-1}
>>                         {identifier-1}
>>
>>
>> will make a return code available to the shell.
>>
>> If you want a status returned to DCL I expect that would do it.
>>
>> bill
>>
>> {I really need to get a VMS system running here again.}
>>
>
> OK, in case anyone is still interested in any of this.
>
> OpenVMS COBOL does not support the RETURNING clause on a STOP RUN.
>
> If you wish to pass a STATUS back to DCL you have to put the
> desired value in the predefined variable RETURN-CODE before
> using STOP RUN.
>
> I tried it and it works fine.
>
> I really miss doing COBOL.  Kinda miss Fortran, too, but not
> as much.  And then there was Pascal.  A shame we lost all the
> good languages.
>
> bill
>

Pascal IS available for x86

--
Chris

Pages:12
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor