HOME  NEWS  FORUM  DOWNLOAD  LINK
OpenCOBOL - an open-source COBOL compiler
Main Menu
Download
Documentation
Development
Who's Online
19 user(s) are online (6 user(s) are browsing Forum)

Members: 0
Guests: 19

more...
Powered by
SourceForge

Xoops

Creative Commons

OpenCOBOL Forum Index
   OpenCOBOL
     Strange compiler behaviour
Register To Post

Flat Previous Topic | Next Topic
Poster Thread
the_piper
Posted on: 2012/4/7 22:42
Just popping in
Joined: 2009/9/18
From:
Posts: 17
Strange compiler behaviour
By narrowing down a problem with generated code, i stumbled about this effect:

Program 1 is not working, compiled with cobc -x. Compiled with cobc -C you can see in the C-program, that the procedure division is empty.
----+-*--1----+----2----+----3----+----4----+----5----+----6----+----7-*--+----8
      **************************************************************************
      *  I D E N T I F I C A T I O N   D I V I S I O N                         *
      **************************************************************************
        IDENTIFICATION  DIVISION.
        PROGRAM-ID.     DBTEST.
        AUTHOR.         PIPER.
        DATE-WRITTEN.   TODAY.
      /
      **************************************************************************
      *  D A T A    D I V I S I O N                                            *
      **************************************************************************
        DATA            DIVISION.
      /
      **************************************************************************
      *  W O R K I N G   S T O R A G E   S E C T I O N                         *
      **************************************************************************
        WORKING-STORAGE SECTIOn.
      /
      **************************************************************************
      *  P R O C E D U R E   D I V I S I O N                                   *
      **************************************************************************
        PROCEDURE DIVISION.
            DISPLAY 'In dbtest'
				STOP RUN.

This program does nothing, when you run it. The text is not displayed, nor is a error message given when compiling it with cobc -x dbtest.cob

But THIS program does what it should do, display the text.

----+-*--1----+----2----+----3----+----4----+----5----+----6----+----7-*--+----8
      **************************************************************************
      *  I D E N T I F I C A T I O N   D I V I S I O N                         *
      **************************************************************************
        IDENTIFICATION  DIVISION.
        PROGRAM-ID.     DBTEST.
      /
      **************************************************************************
      *  D A T A    D I V I S I O N                                            *
      **************************************************************************
        DATA            DIVISION.
      /
      **************************************************************************
      *  W O R K I N G   S T O R A G E   S E C T I O N                         *
      **************************************************************************
        WORKING-STORAGE SECTIOn.
      /
      **************************************************************************
      *  P R O C E D U R E   D I V I S I O N                                   *
      **************************************************************************
        PROCEDURE DIVISION.
            DISPLAY 'In dbtest'
				STOP RUN.


The only difference is, the first program has an AUTHOR and DATE-WRITTEN, the 2nd not.

Try it yourself and see :D

I am using
cobc (OpenCOBOL) 1.0.0
Copyright (C) 2001-2007 Keisuke Nishida
Copyright (C) 2007 Roger While

running it under UBUNTU 10.04

Flat Previous Topic | Next Topic

Subject Poster Date
 » Strange compiler behaviour the_piper 2012/4/7 22:42
     Re: Strange compiler behaviour btiffin 2012/4/8 0:13
       Re: Strange compiler behaviour the_piper 2012/4/8 1:34

Register To Post
 
Copyright (C) 2005 The OpenCOBOL Project. All rights reserved.
Powered by Xoops2 | PHP | MySQL | Apache
ocean-net