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
1 answer

How do I rectify this logical error in printing output in the SYSOUT spool from COBOL program?

This is the cobol code *----------------------- IDENTIFICATION DIVISION. *----------------------- PROGRAM-ID. TOPACCTS AUTHOR. Otto B. Boolean. *-------------------- ENVIRONMENT DIVISION. …
Fnechz
  • 151
  • 8
2
votes
1 answer

Recursive tail function in GnuCOBOL 2.0 (with OpenCobolIDE 4.7.6)

I’m new to COBOL and GnuCOBOL (in Windows). I'm trying to write a recursive function with a tail, but the program does not return values it would be possible to help me. I wonder if what I want is possible in language? Follows function code …
2
votes
1 answer

COBOL: How to turn off SCREEN and come back to terminal

I'm displaying to user a form, defined in SCREEN SECTION. After user input I'd like to clear the screen and go back to terminal. But I have no idea how to do it. Every next DISPLAY "something" puts data back at first row of screen. I don't want to…
aceJacek
  • 23
  • 4
2
votes
1 answer

Does add only work for fields in WORKING-STORAGE SECTION.?

It seems a program like this does not work. PROGRAM-ID. Test. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT CountFile ASSIGN TO "count.dat" ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. …
rogergl
  • 3,501
  • 2
  • 30
  • 49
2
votes
1 answer

Accepting signed values as part of a record

I have a fairly basic Cobol program I'm using to learn about record structures. I'm noticing strange behaviour with gnucobol when passing signed numeric values as part of the record in an ACCEPT statement. The program is defined as…
user1282993
2
votes
2 answers

COBOL - Understanding SET MYSELF

In my COBOL program I have the following statement: SET MYSELF (STATUS) TO -1. What this statement does? I don't understand the MYSELF and STATUS words. It seems that the it gives the status parameter the value -1, am I right? What MYSELF means?
jguilhermemv
  • 769
  • 3
  • 11
  • 28
2
votes
3 answers

COBOL supress last number while summing two decimal numbers

According to the COBOL code below when I try to sum WS-NUM1 with WS-NUM2, COBOL seems to supress the last number. For example: variable WS-NUM1 and WS-NUM2 are 10.15, I get 20.20 as result but expected 20.30. What's wrong? WS-NUM1 PIC…
jguilhermemv
  • 769
  • 3
  • 11
  • 28
2
votes
1 answer

How to write record in a new line.(on the output.dat ile)

I am trying to output the the current console display to the TFileOut.da file. But when I try to write a record, all the data gets outputted into the same line. PROGRAM-ID. TFile. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. …
2
votes
1 answer

How do I call another program in Cobol?

I'm developing a system in Cobol using screen section and I can't call a customer registration program when I select an option in the menu that I created in another program. I am using opencobol with GnuCOBOL compiler. CALL "ANOTHER-PROGRAM" …
2
votes
2 answers

Getting errors not quite sure why this is my first cobol program

Im slowly learning COBOL and am doing some challenges to get better but i am having a weird problem that i cant seem to trace and i wanted to see if anyone else can help I double and triple checked that what was supposed to be in area A and B where…
Malcovious
  • 23
  • 3
2
votes
1 answer

COBOL substring between two finite points

I understand that the string_variable(start:length) can be used to get a substring of a string given a starting point and substring length, however, I am finding that I often need to get a substring between a 'start' and 'end' point. While I know I…
Matt Haidet
  • 338
  • 3
  • 14
2
votes
3 answers

How to do balance line in Cobol using 3 input files?

my challenge on class is code a program which read 3 input txt files and generate 1 txt output file. All input files must be preferentially line sequential mode and no one indexed (this are rules for breaking our minds). File 1 has field ID-USER…
2
votes
1 answer

Invalid type cast from 'null'

I am still new to COBOL and have been working on a project for school for almost a week now. I am running OpenCobol 1.1. When I try to compile it I get this error. typeck.c:5912: Invalid type cast from 'null' Tag 1 0 Tag 2 10 Aborting compile of…
Matt Kane
  • 23
  • 3
2
votes
4 answers

How to execute Cobol without JCL (for home practice)?

I'm in a fast Host training program to join a company, TSO, JCL, Cobol, SQL, etc to be learned at "the speed of light". I'm having a little struggle with Cobol so I want to practise at home, with a virtualized GNUCobol, but in the training we were…
Rajo
  • 71
  • 10
2
votes
2 answers

What's the use of `NOT ON OVERFLOW` in COBOL?

From my understanding when using UNSTRING, the use of ON OVERFLOW [INSTRUCTION] will be useful if there would be an overflow in the use of the UNSTRING. But if there is no overflow, why would you use NOT ON OVERFLOW [INSTRUCTION] ? The only…
NewBie1234
  • 461
  • 6
  • 23