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
1
vote
3 answers

Call function in COBOL more than once

I have my main calling two functions. The second function called (Decrypt) calls the first function (Encrypt) inside of it. So here Encrypt is being called twice. Once in the main, and then once inside of Decrypt. The issue is that it refuses to…
user99999991
  • 1,351
  • 3
  • 19
  • 43
1
vote
3 answers

Read and jump first line and anothers lines in file

How I can read a .dat file with struct like that: ( A = ALPHANUMERIC && N = NUMERIC ) 0AAAAAAAANNNN (233 BLANK SPACES ) 999999 ( SEQUENTIAL NUMBER ONE BY ONE ) 1NNNNNNNNNNNNAAAAAAAAAAAAAAAAAAA (194 BLANK SPACES) 999999 (SEQUENTIAL NUMBER ONE BY…
Alexandre
  • 1,985
  • 5
  • 30
  • 55
1
vote
1 answer

Cobol invalid number on linkage-section

So, I'm studying Cobol and qhen I try to build my code, I get the following error: soma.cob:8: Error: Invalid level number 'linkage-section' the file soma.cob, is that: IDENTIFICATION DIVISION. PROGRAM-ID. SOMA. data division. working-storage…
Alexandre
  • 1,985
  • 5
  • 30
  • 55
0
votes
0 answers

Reading a text file in opencobolile

(Windows 11) I am creating a text file of currently running tasks and I am having difficulty reading it into my OPENCOBOLILE program. The open is fine, but on the first read I receive an error code 1000 (file size error). In looking at the file it…
0
votes
2 answers

Amending/Deleting tasks

I recently reinstalled VSCode having deleted it some time ago. I created a task to compile GnuCOBOL. However when I look at tasks.json my GnuCOBOL entries are there but also entries for the Ada language. I've no idea how they got in there and when I…
paoloricardo
  • 1,353
  • 2
  • 11
  • 10
0
votes
0 answers

How to debug a GnuCOBOL program using cobcdd in Oracle Linux?

I'm trying to use cobcd (cobolworkx - Version 4.28.4) to debug a program. The command is returning the following error on Oracle Linux (Oracle Linux Server release 8.7, GnuCOBOL 3.1.2 and gcc 8.5.0): cobcd -x program.cob program.s: Assembler…
MarcosD
  • 1
  • 1
0
votes
0 answers

Why does output redirection to LPT1 or shared printer not work in MSYS2 and OpenCOBOL?

How can I send output to a shared printer from MSYS2? I mapped a printer using NET USE LPT1 \\home-pc\sysprint /persistent: yes and I can use it from a command prompt: dir >lpt1: or a PowerShell prompt: dir >\\tom-home-pc\sysprint but neither of…
0
votes
0 answers

GnuCobol - How to reset read without reopen?

I started study (again) Cobol, And I found GnuCobol as compiler possibility to use at my Linux box. So, my problem consist at read a sequential file from beginning without reopen, because it is into a procedure. If I reopen, all work is lost :-(. If…
0
votes
1 answer

Error: call to undeclared function 'EXTSM'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]

We are migrating our application from HP-UX to LINUX and some of the c codes are using EXTSM function for sorting, but the application uses COBOL code with GNU COBOL. So, on compiling we are getting undeclared function error. How to replace this…
abhyudyagarg
  • 1
  • 1
  • 4
0
votes
1 answer

Gnucobol not correctly reading copybooks. It's attempting to compile it as a separate program

I am using gnucobol3.1 on Ubuntu 22.04 and trying to compile source code that came from RM/COBOL running on SCO OpenServer6. Several sections of the code are in copybooks, such as the fd for files used, or our standard copyright notice. The compiler…
frankg
  • 1
0
votes
0 answers

why do I get: libcob: implicit closing of file

The program I have written is simple open a file, read it line by line and display selected lines. The file opens and the first read works. I have a perform read-file until EOF. but instead of doing another read it falls out the bottom and gives me…
0
votes
1 answer

Preprocessing with gixsql adds uncompilable gnucobol code

I recently started using gixsql for a project I am working on. https://github.com/mridoni/gix/blob/main/doc/gixsql.md I followed the examples in the readme, but when compiling with GnuCobol the sample TEST001.cbsql is not working: TEST001.cbsql: in…
dreamwagon
  • 1,219
  • 1
  • 15
  • 17
0
votes
2 answers

gnuCobol 'EOF' is not defined

I have the following Gnu Cobol code: IDENTIFICATION DIVISION. PROGRAM-ID. INCOME-TAX-CALCULATOR. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT EMPLOYEE-FILE ASSIGN TO "employees.csv" …
Juanjo
  • 670
  • 7
  • 17
0
votes
1 answer

COBOL (.cob) file cannot open due to unknown encoding

So I was helping my dad's small business in Taiwan migrate old COBOL application from a very old XP computer to a Windows 11 computer. I copied all the COBOL files and installed OpenCobolIDE on the new computer. However, the IDE cannot open the file…
0
votes
2 answers

cobol : how to use a copy on linux?

I would like to know how to use a COPY statement. I am on Linux and I use GnuCOBOL with Visual Studio. I have already tried several things but nothing works... Here is my code: identification division. environment division. data division. …