Re: Memory Corruption? Or Something Else?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Tue, 2 Jul 2024 20:38:05 -0400 gnucobol-users@xxxxxxx wrote:

> 
> On Wed,  3 Jul 2024 09:31:54 -0400 (EDT)
> Robert Heller <heller@xxxxxxxxxxxx> wrote:
> 
> > The code is available on GitHub here: 
> > https://github.com/RobertPHeller/PiggyBank
> > There is just one source file (there is a simple Makefile there as
> > well).
> 
> Hi Robert, 
> 
> I tried to compile PiggyBank.cob with gcobol.   
> 
> 	https://gitlab.cobolworx.com/COBOLworx/gcc-cobol/
> 
> I encountered syntax errors that surprised me, that I describe below.
> (Sadly, I can't recommend gcobol to you, because it has no support for
> SCREEN SECTION, and won't anytime soon because mainframe programs
> usually rely on CICS for user interaction.)
> 
> Still, my curiosity got the better of me.  Could you tell me
> please what version of COBOL you're using?  

marchhare% cobc -version
cobc (GnuCOBOL) 4.0-early-dev.0
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Keisuke Nishida, Roger While, Ron Norman, Simon Sobisch, Edward 
Hart
Built     Sep 19 2022 00:25:48
Packaged  Jun 06 2020 20:56:36 UTC
C version "12.2.0"
marchhare% dpkg-query -l \*cob\* | grep ^ii
ii  gnucobol4         4.0~early~20200606-6+b1 arm64        COBOL compiler
ii  libcob5:arm64     4.0~early~20200606-6+b1 arm64        COBOL compiler - 
runtime library
ii  libcob5-dev:arm64 4.0~early~20200606-6+b1 arm64        COBOL compiler - 
development files
marchhare% cat /etc/debian_version
12.5
heller has logged on pts/4 from :0 at 03-Jul-2024 19:55.
marchhare% cat /etc/issue
Debian GNU/Linux 12 \n \l

marchhare% uname -a 
Linux marchhare 6.6.28+rpt-rpi-2712 #1 SMP PREEMPT Debian 1:6.6.28-1+rpt1 
(2024-04-22) aarch64 GNU/Linux


> 
> $ make COBOL> /usr/local/gcc-cobol/bin/gcobol -o PiggyBank PiggyBank.cob
> PiggyBank.cob:7: syntax error at 'RECORD'
> cobol1: error: failed compiling PiggyBank.cob
> make: *** [Makefile:51: PiggyBank] Error 1
> 
> (Thanks for the Makefile, btw, and especially for the "COBOL" variable!)
> 
> The first error was at 
> 
> 	ORGANISATION IS RECORD BINARY SEQUENTIAL
> 
> The ISO standard does not admit "organisation" with an 's', nor "RECORD
> BINARY" in that clause.  
> 
> What effect does RECORD BINARY have on the program?  It seems to me that
> all COBOL files are organized in records, and handled as binary data.
> COBOL has no notion of "text" files in the Posix sense.  There are LINE
> SEQUENTIAL files, of course, but to COBOL that's a sequence of
> variable-length records delimited by a newline character (usually).  

I did lots of copy-paste from the PDF file "GnuCOBOL 2.2 Final [7Sept2017]
Programmer's Guide" I downloaded from the web somewhere, probably from the
GnuCOBOL website.

I am not sure what RECORD BINARY does (if anything).  I tried various 
things... 

> 
> Later we encounter
> 
> 	PiggyBank.cob:47: syntax error: 01 AccountData: invalid LEVEL
> for OCCURS
> 
> The ISO standard specifically disallows OCCURS for Levels 01, 66, 77,
> and 88. 
> 
> Regarding 1-based indexing,  gcobol by default rejects a 0 index value
> for a table.  If the value is known at compile time, it's a
> compile-time error, else it's a run-time error.  
> 

Without the --debug flag, GnuCOBOL does not do runtime bounds checking.

GnuCOBOL compiles to C code -- that is it is really a COBOL and then I expect it just forks gcc to complete the compilation process.  Of 
course, C does not normally do bounds checking.

> Regards, 
> 
> --jkl
> 
>                                                                                    
> 

-- 
Robert Heller             -- Cell: 413-658-7953 GV: 978-633-5364
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
heller@xxxxxxxxxxxx       -- Webhosting Services
                                                 





[Index of Archives]     [Gcc Help]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Info]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux