Segmentation fault (core dumped) when I run program



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

Segmentation fault (core dumped) when I run program

Postby internauta50 » Wed Mar 23, 2011 12:13 am

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
internauta50
 
Posts: 1
Joined: Wed Mar 23, 2011 12:03 am
Has thanked: 0 time
Been thanked: 0 time

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

 

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

Postby prino » Wed Mar 23, 2011 12:48 am

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.
Robert AH Prins
robert.ah.prins @ the.17+Gb.Google thingy
User avatar
prino
 
Posts: 536
Joined: Wed Mar 11, 2009 12:22 am
Location: Oostende, Belgium
Has thanked: 3 times
Been thanked: 21 times

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

Postby NicC » Wed Mar 23, 2011 1:59 am

My little white box is black - or at least 2 out of the 3 are. The 3rd IS white.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

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

Postby Schubie » Wed Mar 23, 2011 12:01 pm

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.
If a bug is located in a program product which simply cannot be fixed, it becomes a 'feature'. (IBM)
User avatar
Schubie
 
Posts: 10
Joined: Wed Jul 21, 2010 9:16 am
Location: Blue Ridge, GA USA
Has thanked: 0 time
Been thanked: 0 time

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

Postby BillyBoyo » Wed Mar 23, 2011 1:13 pm

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.
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

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

Postby NicC » Wed Mar 23, 2011 4:44 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

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

Postby Schubie » Thu Mar 24, 2011 10:06 am

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.
If a bug is located in a program product which simply cannot be fixed, it becomes a 'feature'. (IBM)
User avatar
Schubie
 
Posts: 10
Joined: Wed Jul 21, 2010 9:16 am
Location: Blue Ridge, GA USA
Has thanked: 0 time
Been thanked: 0 time

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

Postby mickeywhite » Thu Mar 24, 2011 6:12 pm

I compiled and ran it ok on microfocus cobol unix server. created 1 record 3071 bytes long, indexed file with random data. not useable.
mickeywhite
 
Posts: 11
Joined: Tue Nov 02, 2010 8:04 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby enrico-sorichetti » Thu Mar 24, 2011 9:44 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2644
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 130 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post