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:

The preferred IDE and the most convenient way to set up GnuCOBOL is the cross-plattform OCIDE.

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.

160 questions
14
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
  • 93,552
  • 74
  • 254
  • 426
12
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
  • 123
  • 5
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
  • 223
  • 1
  • 11
10
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
  • 468
  • 4
  • 20
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,718
  • 1
  • 20
  • 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,265
  • 8
  • 31
  • 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
  • 265
  • 2
  • 9
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,217
  • 3
  • 17
  • 35
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
  • 32,652
  • 11
  • 79
  • 120
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
  • 6
4
votes
2 answers

Splitting digits from a packed-decimal field

I have a 7-digit packed-decimal field on my file. How can I define data items that would extract/separate these 7 digits? For example I want to have the first two digits in one data item and the other digits in another, so I can manipulate them…
Murad
  • 41
  • 2
4
votes
1 answer

Reading floating-point numbers from file in COBOL

I have fixed-point numbers in file, one in each line, in this format S9(6)V9(2) but when they are actually read, I'm getting non numeric errors while trying to put them in math operations. What is more, when I try to display them in program, a…
Quentin
  • 1,040
  • 10
  • 22
1
2 3
10 11