Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

A pain in the ass of major dimensions. -- C. A. Desoer, on the solution of non-linear circuits


devel / comp.lang.cobol / GnuCOBOL 3.2 and CBL_OR. What am I doing wrong?

SubjectAuthor
* GnuCOBOL 3.2 and CBL_OR. What am I doing wrong?Bruce Axtens
`- Re: GnuCOBOL 3.2 and CBL_OR. What am I doing wrong?Arnold Trembley

1
GnuCOBOL 3.2 and CBL_OR. What am I doing wrong?

<uuq9l5$1n5b7$1@dont-email.me>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=942&group=comp.lang.cobol#942

  copy link   Newsgroups: comp.lang.cobol
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: snetxa@hotmail.com (Bruce Axtens)
Newsgroups: comp.lang.cobol
Subject: GnuCOBOL 3.2 and CBL_OR. What am I doing wrong?
Date: Sat, 6 Apr 2024 09:48:20 +0800
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <uuq9l5$1n5b7$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 06 Apr 2024 01:48:21 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="583d137864003cf476a82c4f12cc5d64";
logging-data="1807719"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/9TYU6nJ0QbozI6CI3Q7BM"
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:8crhj2KKB2CxYnkqeduTa9foXRA=
Content-Language: en-US
 by: Bruce Axtens - Sat, 6 Apr 2024 01:48 UTC

What have I broken here? Based on code in
https://gnucobol.sourceforge.io/faq/GnuCOBOLFAQ.pdf
...
01 LOGICALS.
03 ITEM-1 PIC 999 USAGE COMP-5.
03 ITEM-2 PIC 999 USAGE COMP-5.
03 RESULT USAGE BINARY-LONG.
...
LOGICAL-OR.
INITIALIZE RESULT.
CALL "CBL_OR" USING ITEM-1 ITEM-2 BY VALUE 1
RETURNING RESULT.
DISPLAY ITEM-1 SPACE ITEM-2 SPACE RESULT.
EXIT.

ITEM-1 ITEM-2 RESULT
00001 00253 +0000000000
00002 00253 +0000000000
00004 00253 +0000000000
00008 00253 +0000000000
00016 00253 +0000000000
00032 00253 +0000000000
00064 00253 +0000000000
00128 00253 +0000000000

Why do I only get +0?

Re: GnuCOBOL 3.2 and CBL_OR. What am I doing wrong?

<u4mdnVyVQcoKjIz7nZ2dnZfqnPGdnZ2d@giganews.com>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=943&group=comp.lang.cobol#943

  copy link   Newsgroups: comp.lang.cobol
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!feeder.usenetexpress.com!tr1.iad1.usenetexpress.com!69.80.99.23.MISMATCH!Xl.tags.giganews.com!local-2.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail
NNTP-Posting-Date: Sat, 06 Apr 2024 09:10:47 +0000
Date: Sat, 6 Apr 2024 04:10:47 -0500
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: GnuCOBOL 3.2 and CBL_OR. What am I doing wrong?
Newsgroups: comp.lang.cobol
References: <uuq9l5$1n5b7$1@dont-email.me>
Content-Language: en-US
From: arnold.trembley@att.net (Arnold Trembley)
In-Reply-To: <uuq9l5$1n5b7$1@dont-email.me>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Antivirus: Avast (VPS 240406-0, 4/5/2024), Outbound message
X-Antivirus-Status: Clean
Message-ID: <u4mdnVyVQcoKjIz7nZ2dnZfqnPGdnZ2d@giganews.com>
Lines: 58
X-Usenet-Provider: http://www.giganews.com
X-Trace: sv3-2E3O/38Gtk1Sz8FNT9wKvmJ5GkzsOqpJ73oeKNEo8dw300y20q4e0uhSL2Qid0UneRzjT7uofzDCY2I!BTF9oSauz+mGTxXr1CAUcO14GJZJWCDA/mC/ISIsuC8WMWZt6MHkPnBTOXs27GXNKZidZZcmJw==
X-Complaints-To: abuse@giganews.com
X-DMCA-Notifications: http://www.giganews.com/info/dmca.html
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
 by: Arnold Trembley - Sat, 6 Apr 2024 09:10 UTC

On 2024-04-05 8:48 PM, Bruce Axtens wrote:
> What have I broken here? Based on code in
> https://gnucobol.sourceforge.io/faq/GnuCOBOLFAQ.pdf
>        ...
>        01 LOGICALS.
>          03 ITEM-1 PIC 999 USAGE COMP-5.
>          03 ITEM-2 PIC 999 USAGE COMP-5.
>          03 RESULT USAGE BINARY-LONG.
>        ...
>        LOGICAL-OR.
>            INITIALIZE RESULT.
>            CALL "CBL_OR" USING ITEM-1 ITEM-2 BY VALUE 1
>               RETURNING RESULT.
>            DISPLAY ITEM-1 SPACE ITEM-2 SPACE RESULT.
>            EXIT.
>
> ITEM-1 ITEM-2 RESULT
> 00001  00253  +0000000000
> 00002  00253  +0000000000
> 00004  00253  +0000000000
> 00008  00253  +0000000000
> 00016  00253  +0000000000
> 00032  00253  +0000000000
> 00064  00253  +0000000000
> 00128  00253  +0000000000
>
> Why do I only get +0?

According to the GnuCOBOL 3.2 Programmer's Guide, the result of CBL_OR
using ITEM-1 ITEM-2 BY VALUE 1 is the leftmost 8 bits (BY VALUE 1 BYTE)
and is stored in ITEM-2.

So the reason that RESULT is always zero is that it is initialized to
zero, and it is either never changed or else CBL_OR is always successful
and always sets the return code to zero.

But I would wonder why ITEM-2 is always 253. How wide is a variable
defined as PIC 999 USAGE COMP-5? According to the GnuCOBOL manual,
COMP-5 is the native binary format for your local machine (i.e. little
endian on x86) and the width depends on the number of digits in the
picture clause and the "binary-size" setting in your GnuCOBOL
configuration file.

In the "default.conf" file the allowed binary sizes are 1-2-4-8 (or 8,
16, 32, and 64 bits). Since values of 999 must be supported, ITEM-1 and
ITEM-2 would both be 16 bits little-endian, assuming the default.conf is
used and the instruction set is x86/AMD64.

Kind regards,

--
https://www.arnoldtrembley.com/

--
This email has been checked for viruses by Avast antivirus software.
www.avast.com

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor