You are not logged in.

#1 2008-01-06 13:28:52

sacarde
Member
Registered: 2006-07-14
Posts: 389

opencobol on archlinux-ppc

hi,
   I installed opencobol 1.0 from AUR
butn I have error in compiling from C (I think)

http://www.opencobol.org/modules/newbb/ … id=760#760

how can I install gcc3 and use it  intesad of gcc4 ?


thank you

Offline

#2 2008-01-07 06:52:01

dr_te_z
Member
From: Zoetermeer, the Netherlands
Registered: 2006-12-06
Posts: 154

Re: opencobol on archlinux-ppc

Strange. I've played with both opencobol and tinycobol in the past and the most stricking difference between the 2 is the generated (intermediate) code: opencobol generates C and tinycobol generates assembler. So, opencobol should be the most portable of the 2, and that is exactly what cobol is all about.
I suggest you try to produce some C code, as result form your "hello world", and post the result here.

At the opencobol forum you will not find many C specialists who can help, at this forum you will not find many cobol programmers (humming "feel so lonly" from the Police while I'm writing this) but when you post a piece of C code and wonder why that is not executing.... you might get some answers here...

I've just re-installed arch on my new laptop (AMD64) and I will install opencobol myself soon. This time I will install from the AUR as well (I've been a slackware user too long, the previous I just downloaded and installed fron source myself ...  old habits).

I will post the results from my "helloword.cob" on this threat for comparison.


Somewhere between "too small" and "too large" lies the size that is just right.
- Scott Hayes

Offline

#3 2008-01-07 08:41:36

sacarde
Member
Registered: 2006-07-14
Posts: 389

Re: opencobol on archlinux-ppc

this is hello.s

.file "cob12607_0.c"
.section ".text"
.align 2
.type hello_, @function
hello_:
cmpwi 7,3,0
stwu 1,-32(1)
mflr 0
stw 26,8(1)
stw 27,12(1)
stw 28,16(1)
stw 29,20(1)
stw 30,24(1)
stw 31,28(1)
stw 0,36(1)
blt- 7,.L16
lis 27,.LANCHOR0@ha
lis 9,cob_current_module@ha
lwz 28,.LANCHOR0@l(27)
lis 31,.LANCHOR1@ha
la 30,.LANCHOR0@l(27)
lwz 0,cob_current_module@l(9)
la 26,.LANCHOR1@l(31)
addi 11,30,16
cmpwi 7,28,0
stw 26,cob_current_module@l(9)
addi 29,30,32
stw 0,.LANCHOR1@l(31)
beq- 7,.L17
.L8:
.L13:
lis 9,cob_call_params@ha
li 3,0
lwz 0,cob_call_params@l(9)
lis 9,cob_save_call_params@ha
addi 6,26,28
li 4,1
li 5,1
stw 0,cob_save_call_params@l(9)
stw 0,0(11)
crxor 6,6,6
bl cob_new_display
lwz 3,0(29)
bl cob_stop_run
.L16:
lis 9,.LANCHOR0@ha
lwz 0,.LANCHOR0@l(9)
cmpwi 7,0,0
beq- 7,.L4
li 0,0
stw 0,.LANCHOR0@l(9)
.L4:
lwz 0,36(1)
li 3,0
lwz 26,8(1)
lwz 27,12(1)
mtlr 0
lwz 28,16(1)
lwz 29,20(1)
lwz 30,24(1)
lwz 31,28(1)
addi 1,1,32
blr
.L17:
lis 9,cob_initialized@ha
lwz 0,cob_initialized@l(9)
cmpwi 7,0,0
beq- 7,.L18
lis 3,.LC0@ha
lis 4,.LC1@ha
la 3,.LC0@l(3)
la 4,.LC1@l(4)
li 5,0
bl cob_check_version
lwz 0,.LANCHOR1@l(31)
cmpwi 7,0,0
beq- 7,.L11
lis 3,.LC2@ha
lis 4,hello@ha
lis 5,hello_@ha
la 3,.LC2@l(3)
la 4,hello@l(4)
la 5,hello_@l(5)
bl cob_set_cancel
.L11:
li 0,1
addi 29,30,32
stw 28,16(30)
addi 11,30,16
stw 0,.LANCHOR0@l(27)
stw 28,32(30)
stw 28,48(30)
b .L8
.L18:
li 3,0
bl cob_fatal_error
.size hello_, .-hello_
.align 2
.globl hello
.type hello, @function
hello:
li 3,0
b hello_
.size hello, .-hello
.section ".data"
.align 2
.set .LANCHOR1,. + 0
.type module.6231, @object
.size module.6231, 28
module.6231:
.long 0
.long 0
.long 0
.long 0
.long cob_user_parameters.6230
.byte 0
.byte 46
.byte 36
.byte 44
.byte 1
.byte 1
.byte 1
.byte 0
.type c_1.6228, @object
.size c_1.6228, 12
c_1.6228:
.long 12
.long .LC3
.long a_1.6227
.type a_1.6227, @object
.size a_1.6227, 8
a_1.6227:
.byte 33
.byte 0
.byte 0
.byte 0
.long 0
.section .rodata.str1.4,"aMS",@progbits,1
.align 2
.LC0:
.string "hello.cob"
.zero 2
.LC1:
.string "1.0"
.LC2:
.string "hello"
.zero 2
.LC3:
.string "Hello World!"
.section ".bss"
.align 4
.set .LANCHOR0,. + 0
.type initialized.6229, @object
.size initialized.6229, 4
initialized.6229:
.zero 4
.zero 12
.type b_3.6226, @object
.size b_3.6226, 4
b_3.6226:
.zero 4
.zero 12
.type b_1.6224, @object
.size b_1.6224, 4
b_1.6224:
.zero 4
.zero 12
.type b_2.6225, @object
.size b_2.6225, 4
b_2.6225:
.zero 4
.type cob_user_parameters.6230, @object
.size cob_user_parameters.6230, 256
cob_user_parameters.6230:
.zero 256
.ident "GCC: (GNU) 4.2.2"
.section .note.GNU-stack,"",@progbits

Offline

#4 2008-01-07 09:16:20

dr_te_z
Member
From: Zoetermeer, the Netherlands
Registered: 2006-12-06
Posts: 154

Re: opencobol on archlinux-ppc

No, not that one. Try to generate the C source code.


Somewhere between "too small" and "too large" lies the size that is just right.
- Scott Hayes

Offline

#5 2008-01-07 09:25:35

sacarde
Member
Registered: 2006-07-14
Posts: 389

Re: opencobol on archlinux-ppc

i dont understand...

generation is OK

error is in the execution

Offline

#6 2008-01-07 09:45:40

sacarde
Member
Registered: 2006-07-14
Posts: 389

Re: opencobol on archlinux-ppc

this ? (from my x86)


/* Generated from hello.cob by cobc version 0.33 patch level 0 */

#define  __USE_STRING_INLINES 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <libcob.h>

#define COB_SOURCE_FILE        "hello.cob"
#define COB_PACKAGE_VERSION    "0.33"
#define COB_PATCH_LEVEL        0

/* function prototypes */
static int hello_ (const int);

int hello (void);


/* functions */

int
hello ()
{
  return hello_ (0);
}

/* end functions */

static int
hello_ (const int entry)
{

#include "hello.c.h"  /* local variables */

  static int initialized = 0;
  static cob_field *cob_user_parameters[COB_MAX_FIELD_PARAMS];
  static cob_module module = { NULL, NULL, NULL, NULL, cob_user_parameters, 0, '.', '$', ',', 1, 1, 1, 0};




  /* perform frame stack */
  int frame_index;
  struct frame {
      int perform_through;
      void *return_address;
  } frame_stack[255];

  /* Start of function code */

  if (unlikely(entry < 0)) {
      if (!initialized) {
          return 0;
      }
      initialized = 0;
      return 0;
  }

  module.next = cob_current_module;
  cob_current_module = &module;

  if (unlikely(initialized == 0))
    {
      if (!cob_initialized) {
        cob_fatal_error (COB_FERROR_INITIALIZED);
      }
      cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL);
      if (module.next)
        cob_set_cancel ((const char *)"hello", (void *)hello, (void *)hello_);
      (*(int *) (b_1)) = 0;
      (*(int *) (b_2)) = 0;
      (*(int *) (b_3)) = 0;


      initialized = 1;
    }

  /* initialize frame stack */
  frame_index = 0;
  frame_stack[0].perform_through = -1;

  /* initialize number of call params */
  (*(int *) (b_3))   = cob_call_params;
  cob_save_call_params = cob_call_params;

  goto l_2;

  /* PROCEDURE DIVISION */

  /* hello: */
  l_2:;

  /* MAIN SECTION: */

  /* MAIN PARAGRAPH: */
  /* hello.cob:5: DISPLAY */
  {
    cob_new_display (0, 1, 1, &c_1);
  }
  /* hello.cob:6: STOP */
  {
    cob_stop_run ((*(int *) (b_1)));
  }

  cob_current_module = cob_current_module->next;
  return (*(int *) (b_1));

}

/* end function stuff */

Last edited by sacarde (2008-01-07 09:46:33)

Offline

#7 2008-01-07 09:51:40

sacarde
Member
Registered: 2006-07-14
Posts: 389

Re: opencobol on archlinux-ppc

this is from my  ppc

/* Generated from hello.cob by cobc version 1.0 patch level 0 */

#define  __USE_STRING_INLINES 1
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define WORDS_BIGENDIAN 1
#include <libcob.h>

#define COB_SOURCE_FILE        "hello.cob"
#define COB_PACKAGE_VERSION    "1.0"
#define COB_PATCH_LEVEL        0

/* function prototypes */
static int hello_ (const int);

int hello (void);


/* functions */

int
hello ()
{
  return hello_ (0);
}

/* end functions */

static int
hello_ (const int entry)
{

#include "hello.c.h"  /* local variables */

  static int initialized = 0;
  static cob_field *cob_user_parameters[COB_MAX_FIELD_PARAMS];
  static cob_module module = { NULL, NULL, NULL, NULL, cob_user_parameters, 0, '.', '$', ',', 1, 1, 1, 0};




  /* perform frame stack */
  int frame_index;
  struct frame {
      int perform_through;
      void *return_address;
  } frame_stack[255];

  /* Start of function code */

  if (unlikely(entry < 0)) {
      if (!initialized) {
          return 0;
      }
      initialized = 0;
      return 0;
  }

  module.next = cob_current_module;
  cob_current_module = &module;

  if (unlikely(initialized == 0))
    {
      if (!cob_initialized) {
        cob_fatal_error (COB_FERROR_INITIALIZED);
      }
      cob_check_version (COB_SOURCE_FILE, COB_PACKAGE_VERSION, COB_PATCH_LEVEL);
      if (module.next)
        cob_set_cancel ((const char *)"hello", (void *)hello, (void *)hello_);
      (*(int *) (b_1)) = 0;
      (*(int *) (b_2)) = 0;
      (*(int *) (b_3)) = 0;


      initialized = 1;
    }

  /* initialize frame stack */
  frame_index = 0;
  frame_stack[0].perform_through = -1;

  /* initialize number of call params */
  (*(int *) (b_3))   = cob_call_params;
  cob_save_call_params = cob_call_params;

  goto l_2;

  /* PROCEDURE DIVISION */

  /* hello: */
  l_2:;

  /* MAIN SECTION: */

  /* MAIN PARAGRAPH: */
  /* hello.cob:5: DISPLAY */
  {
    cob_new_display (0, 1, 1, &c_1);
  }
  /* hello.cob:6: STOP */
  {
    cob_stop_run ((*(int *) (b_1)));
  }

  cob_current_module = cob_current_module->next;
  return (*(int *) (b_1));

}

/* end function stuff */

Offline

#8 2008-01-07 11:13:37

sacarde
Member
Registered: 2006-07-14
Posts: 389

Re: opencobol on archlinux-ppc

oh it works

with -x parameter it works



thankyou

and

sorry

Offline

#9 2008-01-07 11:36:59

dr_te_z
Member
From: Zoetermeer, the Netherlands
Registered: 2006-12-06
Posts: 154

Re: opencobol on archlinux-ppc

GREAT! Have fun (glad that "simrw/Roger" was wrong).


Somewhere between "too small" and "too large" lies the size that is just right.
- Scott Hayes

Offline

Board footer

Powered by FluxBB