Questions tagged [gnucobol]

GnuCOBOL is a free (like both in "free speech" and in "free beer") COBOL compiler, formerly known as OpenCOBOL. It implements a substantial part of the COBOL 85, COBOL 2002 and COBOL 2014 standards, as well as many extensions. GnuCOBOL translates COBOL into C and compiles the translated code using the native C compiler on various platforms, including GNU/Linux, Mac OS X, IBM z/OS, Unix, AS/400, and Microsoft Windows.

GnuCOBOL is an implementation of COBOL. For further information see:

An IDE explicit targeting GnuCOBOL is Gix-IDE, which comes with a source-level debugger, ESQL preprocessor and more. Editors based on vscode can also be setup for a "near IDE" experience to edit, compile and debug GnuCOBOL.

Please report bugs and raise issues you see with migrations to GnuCOBOL at either the discussion boards or in the feature request tracker.

Additional tools and COBOL source samples tested with GnuCOBOL are made available by the community.

See info pages for COBOL and COBOL85 for more information about the language.

201 questions
2
votes
2 answers

Cobol interface with C

So, i'm work with C and OpenCobol, and, I whant to know if have an way to get the value of a internal cobol source... for example (based on sample of this link): http://www.opencobol.org/modules/bwiki/index.php?cmd=read&page=UserManual%2F2_3 ----…
Alexandre
  • 1,985
  • 5
  • 30
  • 55
2
votes
3 answers

Can't get proper file output

This is a homework assignment that involves reading in an input file, doing some processing, and printing the processed data to an output file in a neat and readable format. The first record prints to the output file perfectly. Every record after…
user1364920
  • 21
  • 1
  • 2
1
vote
0 answers

OpenCobol compiler switch to allow duplcate data/paragraph names

Does anyone know of an OpenCobol compiler switch to allow using the same name for both a data item and a paragraph. I'm experimenting with version 1.1 and trying to migrate code from our AcuCobol (Now Micro-Focus Extend) dialect programs. Our…
DuncanKinnear
  • 4,563
  • 2
  • 34
  • 65
1
vote
4 answers

Getting rid of "warning: dereferencing type-punned pointer"

I'm trying out OpenCobol with a simple Hello World example. IDENTIFICATION DIVISION. PROGRAM-ID. HELLO. PROCEDURE DIVISION. DISPLAY "Hello World". STOP RUN. I compile with cobc -x -free -o hello hello.cbl And get a workable executable, but…
user606547
1
vote
0 answers

How to print nested Control Headings using Report Writer and GnuCOBOL?

I'm trying to create a report declared in the "report section" of a COBOL program. The program takes the data.txt file as input, and writes the report to the report.txt file. Here you can see the COBOL source code followed by the content of the…
Zug
  • 113
  • 6
1
vote
4 answers

COBOL, populating a table

New to COBOL.. I would like to populate a table. I want it to have two columns and eight rows in each column. I want to "hard code" these different values into the first colum, with one in each field. They are Non-integer fixed point values (Swedish…
1
vote
0 answers

Display order doesn't show nothing of file content when is executed a compiled .cbl file with cobcrun

I am trying to execute this code: ****************************************************************** * Author: * Date: * Purpose: * Tectonics: cobc ****************************************************************** IDENTIFICATION…
reymagnus
  • 327
  • 2
  • 17
1
vote
1 answer

cobc generated "Segmentation fault" for gnuCOBOL

I'm trying to compile and execute the hello world example in: https://gnucobol.sourceforge.io/historical/open-cobol/Hello-World-.html But when I compile with: $ cobc hello.cob I get a hello.so file. I execute with ./hello.so and get this…
reymagnus
  • 327
  • 2
  • 17
1
vote
1 answer

COBOL error with numeric variable, not numeric

problem I'm a beginner in COBOL and I'm running into this annoying problem which I can not find a solution for. I want to add the value of the amount of sales to another numeric variable so that I can use it as a condition for a perform loop but…
1
vote
1 answer

No write to file

I'm trying to make a simple COBOL program that takes user inputs and writes them to a .txt file. My program successfully creates a .txt file, however, it fails to record any of the input, and for the life of me I can't figure out why. I want it to…
1
vote
1 answer

ACCEPT (variable) FROM ESCAPE KEY does not react

I am a beginner in COBOL and I am having a little error. When I do a simple statement like ACCEPT (variable) FROM ESCAPE KEY, the program doesn't react to the esc key. I understand that something needs to be done with the compiler but I'm not too…
1
vote
2 answers

Getting a 64 bit return value from a C function in GNU COBOL

I need to call a function written in C from a GNU COBOL program which returns a 64 bit integer (BINARY-DOUBLE in COBOL). However, it seems like GNU COBOL assumes that the return value is always BINARY-LONG, which means the return value is messed…
1
vote
2 answers

Subtract 1 from all the following record key after deleting a specific one

i want to delete a specific item then subtract 1 from all the following item-id so it would look like something like this: item-id item-name qty price [01] Item 1 10 99 [02] Item 2 10 99 [03] Item 3 10 99 [04] Item 4 …
1
vote
1 answer

Linkage section area has null address

I'm working on a COBOL program and it calls an external module to do a simple calculation. When I run the program it's giving me an error that says my linkage section has a null address and I don't know why Here is the screen shot of the…
1
vote
1 answer

COBOL ERASE sentence

I'm watching COBOL tutorials, they use the "erase" statement to clean the screen and it doesn't work for me. The compiler indicates "syntax error, unexpected ERASE" The code is: DISPLAY "1.- CALC, 2.- CLOSE" ERASE. It is my mistake? I am using…
Liosoft
  • 11
  • 1