Page 1 of 1

Segmentation fault (core dumped) when I run program

PostPosted: Wed Mar 23, 2011 12:13 am
by internauta50
Hello,
Please help me. Im beginner in COBOL and at the moment am learnig. A read course with the site http://www.podgoretsky.com/ftp/Docs/Cob ... 1/ch11.htm

I compile program

000100 IDENTIFICATION DIVISION.
000200 PROGRAM-ID. VNDBLD01.
000300*------------------------------------------------
000400* Create an Empty Vendor File.
000500*------------------------------------------------
000600 ENVIRONMENT DIVISION.
000700 INPUT-OUTPUT SECTION.
000800 FILE-CONTROL.
000900
001000     SELECT VENDOR-FILE
001100         ASSIGN TO "vendor"
001200         ORGANIZATION IS INDEXED
001300         RECORD KEY IS VENDOR-NUMBER
001400         ACCESS MODE IS DYNAMIC.
001500
001600 DATA DIVISION.
001700 FILE SECTION.
001800
001900 FD  VENDOR-FILE
002000     LABEL RECORDS ARE STANDARD.
002100 01  VENDOR-RECORD.
002200     05  VENDOR-NUMBER                    PIC 9(5).
002300     05  VENDOR-NAME                      PIC X(30).
002400     05  VENDOR-ADDRESS-1                 PIC X(30).
002500     05  VENDOR-ADDRESS-2                 PIC X(30).
002600     05  VENDOR-CITY                      PIC X(20).
002700     05  VENDOR-STATE                     PIC X(2).
002800     05  VENDOR-ZIP                       PIC X(10).
002900     05  VENDOR-CONTACT                   PIC X(30).
003000     05  VENDOR-PHONE                     PIC X(15).
003100
003200 WORKING-STORAGE SECTION.
003300
003400 PROCEDURE DIVISION.
003500 PROGRAM-BEGIN.
003600     OPEN OUTPUT VENDOR-FILE.
003700     CLOSE VENDOR-FILE.
003800
003900 PROGRAM-DONE.
004000     STOP RUN.
004100


but when a try run program after compiling I get:
DB->get_open_flags: method not permitted before handle's open method
Segmentation fault (core dumped)

Why?
I use system fedora and compiler opencobol

Re: Segmentation fault (core dumped) when I run program

PostPosted: Wed Mar 23, 2011 12:48 am
by prino
This is, as the URL states, a forum for IBM mainframes, for compilers running on little white boxes you should go to fora that deal with these little white boxes.

Re: Segmentation fault (core dumped) when I run program

PostPosted: Wed Mar 23, 2011 1:59 am
by NicC
My little white box is black - or at least 2 out of the 3 are. The 3rd IS white.

Re: Segmentation fault (core dumped) when I run program

PostPosted: Wed Mar 23, 2011 12:01 pm
by Schubie
I'm not going to give you a razz about what box you are working with. I programmed for boxes made by Hitachi and got enough grief for that, so I won't do that to you.
You stated in your comments that you were creating an "empty vendor file". An INDEXED dataset could be either VSAM or ISAM. VSAM datasets (clusters) are not created by running a COBOL program but by the IDCAMS utility so I suspect that your dataset may be ISAM. ISAM datasets are created sequentially and must contain at least one record. An "empty" ISAM file is created "ACCESS IS SEQUENTIAL" and you would need to write one record with the highest key you expect the file to have. You cannot simply OPEN and CLOSE an ISAM dataset to create an "empty" file. Trying such can only lead to unpredictable results.
I've been out of this business for some time and ISAM may have gone the way of the 'round reel' tape ( I certainly hope so ) but I did my best to help.
Good luck.

Re: Segmentation fault (core dumped) when I run program

PostPosted: Wed Mar 23, 2011 1:13 pm
by BillyBoyo
internauta50 wrote:
but when a try run program after compiling I get:
DB->get_open_flags: method not permitted before handle's open method
Segmentation fault (core dumped)

Why?



Looks like an Oracle DB message. Did you point your program at an Oracle file somehow?

Schubie, we think the guy is on a PC. Although Hitachi made PCs, I think you're talking of something else.

Re: Segmentation fault (core dumped) when I run program

PostPosted: Wed Mar 23, 2011 4:44 pm
by NicC
You should also try the Open COBOL forum(s) and perhaps a Fedora, or other Linux flavour, forum that has a section for COBOL. The people there are more likely to have experience in such a combination compared to the people here.

Re: Segmentation fault (core dumped) when I run program

PostPosted: Thu Mar 24, 2011 10:06 am
by Schubie
Thanks, Billy. One never can tell these days. The last system I was on actually was a PC running OS/390 under OS/2. Complete with a RAID emulating a boatload of 3380s, the whole thing rack-mounted about 4' high. The Hitachi units were big as a house trailer... but that was years ago. Have a great weekend.

Re: Segmentation fault (core dumped) when I run program

PostPosted: Thu Mar 24, 2011 6:12 pm
by mickeywhite
I compiled and ran it ok on microfocus cobol unix server. created 1 record 3071 bytes long, indexed file with random data. not useable.

Re: Segmentation fault (core dumped) when I run program

PostPosted: Thu Mar 24, 2011 9:44 pm
by enrico-sorichetti
that' s what the whole issue is about...
the TS is following/using snippets posted in a tutorial using MICROFOCUS cobol
but on the other side he is using opencobol!

a bit of manual reading and research might be helpful