Operating System - Linux
1827454 Members
5336 Online
109965 Solutions
New Discussion

error in cobol compilation

 
Allan Campbell
Advisor

error in cobol compilation

Both of my servers are running HPUX 11.11 with identical current patches. When the following command is run, the older system compiles OK, the new system gets the error you see below: "/opt/cobol/cobdir/bin/cob -x -o ~/temp/repbuild repbuild.o"
response:
"as: unrecognized option `-41'
/opt/mfcobol/cobdir/bin/cob: error(s) in assembling /var/tmp/cobBAAa13298/%cob0.s"
These are running Cobol41 with these bundles - B2430EB, B2432EB, B2433EB, and B2435.
18 REPLIES 18
A. Clay Stephenson
Acclaimed Contributor

Re: error in cobol compilation

The very first thing that I would compare is the environment. Do an env as the same user on both boxes and compare them. Pay special attention to COBDIR.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: error in cobol compilation

2nd whackball thought: Are both of these boxes running the same "bitness" of the operating system?
If it ain't broke, I can fix that.
Allan Campbell
Advisor

Re: error in cobol compilation

Already checked. env is the same. I do notice a difference in the file directories located in /opt/cobol/bin. Even though the cobol installed is the same. The newer install has more directories. The dates appear to be the same on the ones that are there. Also /opt/cobol/bin/cobol appears to be the same on both.
Allan Campbell
Advisor

Re: error in cobol compilation

older is N4000. newer is rp3410.
A. Clay Stephenson
Acclaimed Contributor

Re: error in cobol compilation

Is the current user's home directory writable? I would also try invoking the command without the tidle and instead using the absolute path for the -o (output) file. I assume that the .o object file was actually created on this machine.
If it ain't broke, I can fix that.
A. Clay Stephenson
Acclaimed Contributor

Re: error in cobol compilation

It's been a long time (thankfully) since I've had to do any COBOL work but one other thing that I found in my notes: compare the contents of ${COBDIR}/cobopts on the good and bad boxes. All this command should be doing is passing the repbuild.o to the linker (ld) for linking to create the executable so the reference to a .S (assembly source) .S is a bit strange. If this is a makefile then use -n to show the exact commands that would be executed. If this is not a makefile then it appears that you are omitting a critical piece of the puzzle.
If it ain't broke, I can fix that.
Dennis Handly
Acclaimed Contributor

Re: error in cobol compilation

Which as(1) are you running? Do you have the gnu as(1) installed or in your PATH on one and not the other?

HP's as(1) gives these messages:
$ as -41 #PA
as: warning 2: Unknown option "-41" ignored.
$ as -41 #IPF
error 2005: invalid option '-41'

The foreign devil as(1) gives:
$ /usr/local/bin/as -41
/usr/local/bin/as: unrecognized option `-41'

Of course in both cases it doesn't like the -41. Is there a way to get a verbose output from cob, -v?
A. Clay Stephenson
Acclaimed Contributor

Re: error in cobol compilation

I actually think the -41 is an artifact of the COBOL Version 41 and that is being passed possibly because the compiler is being asked to output the version as if cob -V were invoked.
If it ain't broke, I can fix that.
Allan Campbell
Advisor

Re: error in cobol compilation

I had the user create a new .o file - same problem. Then (as root) I ran the following command "/opt/cobol/cobdir/bin/cob -x -v -o /tmp/cobtest". This created /tmp/cobtest on the old server, but error was
"/opt/cobol/cobdir/bin/cob -V nolist -x -v -o /tmp/cobtest
as: unrecognized option `-41'
/opt/mfcobol/cobdir/bin/cob: error(s) in assembling /var/tmp/cobBAAa26968/ldtaab.s"
The -V nolist line was the first part of the returned message on both servers.
A. Clay Stephenson
Acclaimed Contributor

Re: error in cobol compilation

Did you compare the cobopts files on both boxes?
If it ain't broke, I can fix that.
Allan Campbell
Advisor

Re: error in cobol compilation

identical
-C nolist
A. Clay Stephenson
Acclaimed Contributor

Re: error in cobol compilation

Before doing anything else, let's make certain this is an apples to apples comparison, do a cksum of cob on both boxes. Are they identical?
If it ain't broke, I can fix that.
Allan Campbell
Advisor

Re: error in cobol compilation

identical cksum
A. Clay Stephenson
Acclaimed Contributor

Re: error in cobol compilation

Okay, I'm stumped but I did find an old box with your version of the COBOL compiler (although it is beyond me why anyone would ever use COBOL) but let's try a different approach so that we are starting from a known point. We'll use the tictac demo program.

cp /opt/cobol/cobdir/demo/tictac.cbl /tmp
cd /tmp
cob -V -v -x -o tictac tictac.cbl

Here is the output on my box, please post yours so that we can compare (I've also set cobopt to match your settings):

[marvin]/tmp: echo ${COBOPT}
sh: COBOPT: Parameter not set.
[marvin]/tmp: echo ${COBDIR}
/opt/cobol/cobdir

[marvin]/tmp: cob -V -v -x -o tictac tictac.cbl
version @(#)cob.c 1.254
PRN=O1UPR/BMD:8e.B4.13.06
PTI=NLS
PTI=Y2K
cob -C nolist -V -v -x -o tictac tictac.cbl
* Micro Focus COBOL for UNIX V4.1 revision 040 Compiler
* Copyright (C) 1984-1999 MERANT International URN O1UPR/BMB/01345T
* Accepted - verbose
* Accepted - nolist
* Compiling tictac.cbl
* Total Messages: 0
* Data: 2536 Code: 1313
* Micro Focus COBOL for Unix V4.1 revision 040 Code generator
* Copyright (C) 1984-1999 MERANT International URN OXUPR/BM0/00000T
* Accepted - verbose
* Accepted - hpoptimize(1)
* Generating tictac.int
* Data: 2704 Code: 0 Literals: 280
cob: Entry points defined in module: tictac.o
*tictac
TICTAC
_HP_tictac
[marvin]/tmp:

[marvin]/tmp:
[marvin]/tmp: ls -l tictac*
-rwxrwx--x 1 cstephen bsp 36864 Aug 4 10:30 tictac
-rw-r--r-- 1 cstephen sys 7882 Aug 4 09:41 tictac.cbl
-rw-rw---- 1 cstephen bsp 3584 Aug 4 10:30 tictac.int
-rw-rw---- 1 cstephen bsp 7160 Aug 4 10:30 tictac.o

If it ain't broke, I can fix that.
Allan Campbell
Advisor

Re: error in cobol compilation

cp /opt/cobol/cobdir/demo/tictac.cbl /tmp
cd /tmp
root@ddah0826:/home/acampb07: cd /tmp
root@ddah0826:/tmp: cob -V -v -x -o tictac tictac.cbl

version @(#)cob.c 1.248
PRN=OXUPR/ZZB:8c.l5.13.03
PTI=NLS
PTI=LMF
PTI=ASLMF
PTI=Y2K
cob -C nolist -V -v -x -o tictac tictac.cbl
* Micro Focus COBOL for UNIX V4.1 revision 030 Compiler
* Copyright (C) 1984-1999 MERANT International URN OXUPR/ZZ0/00000V
* Accepted - verbose
* Accepted - nolist
* Compiling tictac.cbl
* Total Messages: 0
* Data: 2536 Code: 1313
* Micro Focus COBOL for Unix V4.1 revision 030 Code generator
* Copyright (C) 1984-1999 MERANT International URN OXUPR/ZZ0/00000V
* Accepted - verbose
* Accepted - hpoptimize(1)
* Generating tictac.int
* Data: 2704 Code: 0 Literals: 280
cob: Entry points defined in module: tictac.o
*tictac
TICTAC
_HP_tictac
as: unrecognized option `-41'
cob: error(s) in assembling /var/tmp/cobBAAa18880/%cob0.s
root@ddah0826:/tmp: root@ddah0826:/tmp: ls -l tic*
-rw------- 1 root sys 7882 Aug 4 15:23 tictac.cbl
-rw------- 1 root sys 3584 Aug 4 15:23 tictac.int
-rw------- 1 root sys 7276 Aug 4 15:23 tictac.o
A. Clay Stephenson
Acclaimed Contributor

Re: error in cobol compilation

Clearly your assembler is having problems:

Try this command and also this time echo ${COBDIR} and ${COBOPT} -- which may be unset so it is apples to apples.

We're going to add -A -V to make the assembler output it's version:

[marvin]/tmp:
[marvin]/tmp: echo ${COBDIR}
/opt/cobol/cobdir
[marvin]/tmp: echo ${COBOPT}
sh: COBOPT: Parameter not set.
[marvin]/tmp: cob -V -v -x -A -V -o tictac tictac.cbl
version @(#)cob.c 1.254
PRN=O1UPR/BMD:8e.B4.13.06
PTI=NLS
PTI=Y2K
cob -V -v -x -A -V -o tictac tictac.cbl
* Micro Focus COBOL for UNIX V4.1 revision 040 Compiler
* Copyright (C) 1984-1999 MERANT International URN O1UPR/BMB/01345T
* Accepted - verbose
* Compiling tictac.cbl
* Total Messages: 0
* Data: 2536 Code: 1313
* Micro Focus COBOL for Unix V4.1 revision 040 Code generator
* Copyright (C) 1984-1999 MERANT International URN OXUPR/BM0/00000T
* Accepted - verbose
* Accepted - hpoptimize(1)
* Generating tictac.int
* Data: 2704 Code: 0 Literals: 280
cob: Entry points defined in module: tictac.o
*tictac
TICTAC
_HP_tictac
as: HP92453-03 UX.11.01.17 PA-RISC 2.0 Assembler
as: HP92453-03 UX.11.01.17 PA-RISC 2.0 Assembler
[marvin]/tmp:

----------------------------------------
What I am beginning to wonder is did you install ANSI/C along with COBOL because both are required.
If it ain't broke, I can fix that.
Allan Campbell
Advisor

Re: error in cobol compilation

Now you have led me on the right path. The /usr/ccs/bin/as files are of different sized on the two servers. I found a bypass now by taking the as file from the old server and copying it to the new server (after saving the new server as file of course). Now that I was on the right path, I found the problem. The gcc product that was installed creates a /usr/ccs/bin/as file that caused the problem. The new servers were built with all current patches, however the gcc was put on after the patches. To correctly resolve my problem I reinstalled patch PHSS_26321 which put the correct as file in place. Thanks for your help!
Allan Campbell
Advisor

Re: error in cobol compilation

Thanks for help on this one - see my last post for solution text