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
15
votes
2 answers

How to run cobc without an input source file, but via a pipe?

Is it possible to execute COBOL code without providing input files? I'm using cobc. I tried to pipe the code to the cobc process: $ cat my-input.cbl | cobc cobc: No input files To compile a file and run it, I do: cobc -x di.cbl -o a &&…
Ionică Bizău
  • 109,027
  • 88
  • 289
  • 474
13
votes
3 answers

Unprintable integer pointer returned to GNU COBOL from C library

I am learning COBOL just for the fun of it and now want to call C functions from my COBOL source (using GnuCOBOL). I can call C functions just fine, however I have a small problem with a function of mine that looks like this: (It just wraps another…
Deps
  • 133
  • 5
12
votes
1 answer

Error with gmp when compiling helloworl in COBOL

I want to run this hello world program, in COBOL : Identification Division. program-id. HelloWorld. Procedure Division. Display 'Bonjour '. Display 'Comment allez vous ? ' . goback. But, I have this error : In file included from…
Stalyon
  • 538
  • 5
  • 20
10
votes
2 answers

COBOL - Differing answer from mainframe to PC for same COMPUTE

I have this very simple dummy COBOL program which does a dummy COMPUTE and displays the result. ID DIVISION. PROGRAM-ID. DUMMYPGM. DATA DIVISION. WORKING-STORAGE SECTION. 01 NUM-A PIC 9(3) VALUE 399. 01 NUM-B PIC 9(3) VALUE 211. …
Gael L
  • 243
  • 1
  • 11
9
votes
2 answers

GnuCOBOL failing to find dynamic symbols, only on recent Ubuntu

Something changed recently, I think. GnuCOBOL relies on dynamic linking, symbols looked up with dlsym at run-time. This CALL run-time support code has been in OpenCOBOL for some 7 years now. It no longer works on Ubuntu 14.04, but does under…
Brian Tiffin
  • 3,978
  • 1
  • 24
  • 34
7
votes
4 answers

Getting started with OpenCOBOL! ("Hello world!")

I'm trying to make a very simple COBOL program. I've gotten my directory, configurations, etc. all set up, but when I go to compile it I get this error: sampleCOBOL.cbl: In paragraph 'Main-Paragraph' : sampleCOBOL.cbl:9: Error: syntax error,…
Bryan Strobehn
  • 123
  • 2
  • 6
6
votes
1 answer

Ubuntu GnuCobol CURRENCY SIGN IS "£" causes compile errors

Using GnuCOBOL 2.2.0 on Ubuntu 18.10. Working through 'Beginning COBOL for Programmers' by Michael Coughlan. GnuCOBOL has been compiling the book's examples without trouble up until Chapter 9, when this program: IDENTIFICATION DIVISION. PROGRAM-ID.…
6
votes
5 answers

Standard way to remove spaces from input in cobol?

I'm just learning COBOL; I'm writing a program that simply echos back user input. I have defined a variable as: User-Input PIC X(30). Later when I ACCEPT User-Input, then DISPLAY User-Input " plus some extra text", it has a bunch of spaces to fill…
Shawn J. Goff
  • 4,635
  • 8
  • 34
  • 38
5
votes
1 answer

Ubuntu GnuCOBOL program DISPLAYs '�' character instead of '£' in edited picture

Unfortunately there is a Part 2 to my earlier question. That link shows a simple COBOL program moving a value to an edited picture that should precede the value with a '£'. As per the answer to the earlier question, it's necessary to explicitly set…
5
votes
1 answer

PostgreSQL Cursor Re-open error in GnuCOBOL

I am trying to move from Oracle to PostgreSQL on GnuCOBOL. I have a piece of code which uses cursors and need opening a cursor multiple times. However when trying to open the cursor again I get the error ERROR: cursor "fetchtbl_c1" already exists …
Ankit Jain
  • 314
  • 3
  • 10
5
votes
2 answers

Nested Perform Loops in COBOL?

Why can I not do this nested perform loop in COBOL? If I put END-PERFORM. in any line sooner than where I have the last one just before EXIT PROGRAM - it works. But I need the program to display the INPUT C value every time. in the outer perform…
user99999991
  • 1,351
  • 3
  • 19
  • 43
5
votes
6 answers

When to use dots in COBOL?

I'm completely new to COBOL, and I'm wondering: There seems to be no difference between DISPLAY "foo" and DISPLAY "foo". What does the dot at the end of a line actually do? When should I use/avoid it?
Philip
  • 5,795
  • 3
  • 33
  • 68
4
votes
3 answers

Windows GUI Programming with OpenCOBOL?

I'm completely new to COBOL, but I'd like to take a look at the different options for GUI programming on Windows. I don't really like Tcl/Tk, though. Is there some resource for developing a Windows GUI in COBOL in the same manner that one would…
David Brown
  • 35,411
  • 11
  • 83
  • 132
4
votes
4 answers

Command Wait in COBOL?

Is there a kind of "Wait" function in COBOL? I wrote a calculator, and to make it more 50s, i Print " Computing." "Computing.." ecc For example: DISPLAY "SECONDO NUMERO" ACCEPT B COMPUTE C= A…
aIDserse
  • 131
  • 8
4
votes
1 answer

Compiling a windows (.exe) executable file using gnu cobol on ubuntu

I need a program I wrote in a .cobc file to be compiled to a windows executable file. The file is called main.cobc Compiling it with: cobc -x -free *.cobc -o main makes it a linux executable which is ok, but can't be run directly on windows. I…
JP_99
  • 125
  • 8
1
2 3
13 14