Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Unable to compile
Hello,
I'm new to cobol, just want to see what the lang is like, compile a few
programs, learn syntax etc.

I have got two programs, the first is Calculator.cob with code below.
$ SET SOURCEFORMAT"FREE"
IDENTIFICATION DIVISION.
PROGRAM-ID. Selection-Program.

DATA DIVISION.
WORKING-STORAGE SECTION.
01	Num1	PIC 9	VALUE ZEROS.
01	Num2	PIC 9	VALUE ZEROS.
01	Result	PIC 99	VALUE ZEROS.
01	Operator PIC X	VALUE SPACE.

PROCEDURE DIVISION.
Calculator.
ACCEPT Num1.
ACCEPT Num2.
ACCEPT Operator
IF Operator = "+" THEN
ADD Num1, Num2 GIVING Result
END-IF
IF Operator = "*" THEN
MULTIPLY Num1 BY Num2 GIVING RESULT
END-IF
DISPLAY "Result is = ", Result
STOP RUN.

The second is SmallestProgram.cob:

IDENTIFICATION DIVISION.
PROGRAM-ID.  SmallestProgram.

PROCEDURE DIVISION.
DisplayPrompt.
DISPLAY "I did it".
STOP RUN.

I am trying to compile them with the COBOL650 and Fujitsu COBOL 3.0
however the Fugitsu displays a really wrong error and the 650 doesnt do
anything.

Could you please provide me with some help on this matter ASAP as I
would really like to be able to compile these programs.


Thankyou

Ben
Ben@NOSAPMSkyBlueConnections.co.uk - Remove NOSAPM to reply :)

Report this thread to moderator Post Follow-up to this message
Old Post
Ben Hall
09-19-04 01:55 PM


Re: Unable to compile
On Sun, 19 Sep 2004 11:56:28 +0000 (UTC), Ben Hall
<Ben@NOSAPMSkyBlueConnections.co.uk> wrote:

>Hello,
>I'm new to cobol, just want to see what the lang is like, compile a few
>programs, learn syntax etc.
>

Snip code.

The error each compiler is issuing would be very important to know.
>
>I am trying to compile them with the COBOL650 and Fujitsu COBOL 3.0
>however the Fugitsu displays a really wrong error and the 650 doesnt do
>anything.
>
>Could you please provide me with some help on this matter ASAP as I
>would really like to be able to compile these programs.
Withouth the error it is just guessing, but I think you may need to
tell the compiler which one is the main program.

Try option main in the first line of your program.
@OPTION MAIN
>
>
>Thankyou
>
>Ben
>Ben@NOSAPMSkyBlueConnections.co.uk - Remove NOSAPM to reply :)



Frederico Fonseca
ema il: frederico_fonseca at syssoft-int.com

Report this thread to moderator Post Follow-up to this message
Old Post
Frederico Fonseca
09-19-04 01:55 PM


Re: Unable to compile
Ok this is what happens when I try and compile SmallestProgram.cob

Start Run cmd
cobol - press esc,  enter SmallestProgram, press esc
dir
still only displays the cobol compiler and smallestprogram - no obj or
msg files.

When going via the Fujitsu one

Programming staff > tools > wincob
select smallestprogram > options > add mail to compile as main program
Compile > error

** DIAGNOSTIC MESSAGE ** (NOPRGMID)
C:\COBOL650\SmallestProgram.cob 0: JMN1102I-S  IDENTIFICATION DIVISION
HEADER IS MISSING. HEADER ASSUMED TO BE CODED.
C:\COBOL650\SmallestProgram.cob 1: JMN1005I-W  CHARACTER STRING 'MAIN'
MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 1: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 1: JMN1356I-W  INVALID WORD 'MAIN' IS
SPECIFIED IN IDENTIFICATION DIVISION. IGNORED UNTIL NEXT PARAGRAPH OR
DIVISION.
C:\COBOL650\SmallestProgram.cob 2: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 2: JMN1005I-W  CHARACTER STRING
'ICATION' MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 3: JMN1104I-S  PROGRAM-ID PARAGRAPH IS
MISSING. PROGRAM-NAME GENERATED BY SYSTEM.
C:\COBOL650\SmallestProgram.cob 3: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 3: JMN1041I-W  SEPARATOR MUST FOLLOW
CHARACTER STRING. SEPARATOR ASSUMED.
C:\COBOL650\SmallestProgram.cob 3: JMN1100I-W  WORD 'DIVISION' OR
'SECTION' IS MISSING. WORD ASSUMED TO BE CODED.
C:\COBOL650\SmallestProgram.cob 3: JMN1356I-W  INVALID WORD
'SMALLESTPROGRAM' IS SPECIFIED IN IDENTIFICATION DIVISION. IGNORED UNTIL
NEXT PARAGRAPH OR DIVISION.
C:\COBOL650\SmallestProgram.cob 5: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 5: JMN1005I-W  CHARACTER STRING 'RE'
MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 6: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 6: JMN1004I-W  RESERVED WORD 'PROMPT'
MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 7: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 7: JMN1005I-W  CHARACTER STRING 'PLAY'
MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 8: JMN1044I-S  PROGRAM CONTAINED WITHIN
PROGRAM 'NOPRGMID' MUST END WITH END PROGRAM HEADER. END PROGRAM HEADER
ASSUMED.
C:\COBOL650\SmallestProgram.cob 8: JMN1291I-S  PROGRAM-NAME PARAGRAPH
MUST BE SPECIFIED IN IDENTIFICATION DIVISION.
C:\COBOL650\SmallestProgram.cob 8: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 8: JMN1005I-W  CHARACTER STRING 'P' MUST
START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 8: JMN1004I-W  RESERVED WORD 'RUN' MUST
START IN AREA B. ASSUMED TO START IN AREA B.
STATISTICS: HIGHEST SEVERITY CODE=S, PROGRAM UNIT=1

^^^^^^^^^^^ thats with @Option Main at the top of the code

Below is the error without it:


** DIAGNOSTIC MESSAGE ** (NOPRGMID)
C:\COBOL650\SmallestProgram.cob 0: JMN1102I-S  IDENTIFICATION DIVISION
HEADER IS MISSING. HEADER ASSUMED TO BE CODED.
C:\COBOL650\SmallestProgram.cob 1: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 1: JMN1005I-W  CHARACTER STRING
'ICATION' MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 1: JMN1356I-W  INVALID WORD 'ICATION' IS
SPECIFIED IN IDENTIFICATION DIVISION. IGNORED UNTIL NEXT PARAGRAPH OR
DIVISION.
C:\COBOL650\SmallestProgram.cob 2: JMN1104I-S  PROGRAM-ID PARAGRAPH IS
MISSING. PROGRAM-NAME GENERATED BY SYSTEM.
C:\COBOL650\SmallestProgram.cob 2: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 2: JMN1041I-W  SEPARATOR MUST FOLLOW
CHARACTER STRING. SEPARATOR ASSUMED.
C:\COBOL650\SmallestProgram.cob 2: JMN1100I-W  WORD 'DIVISION' OR
'SECTION' IS MISSING. WORD ASSUMED TO BE CODED.
C:\COBOL650\SmallestProgram.cob 2: JMN1356I-W  INVALID WORD
'SMALLESTPROGRAM' IS SPECIFIED IN IDENTIFICATION DIVISION. IGNORED UNTIL
NEXT PARAGRAPH OR DIVISION.
C:\COBOL650\SmallestProgram.cob 4: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 4: JMN1005I-W  CHARACTER STRING 'RE'
MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 5: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 5: JMN1004I-W  RESERVED WORD 'PROMPT'
MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 6: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 6: JMN1005I-W  CHARACTER STRING 'PLAY'
MUST START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 7: JMN1044I-S  PROGRAM CONTAINED WITHIN
PROGRAM 'NOPRGMID' MUST END WITH END PROGRAM HEADER. END PROGRAM HEADER
ASSUMED.
C:\COBOL650\SmallestProgram.cob 7: JMN1291I-S  PROGRAM-NAME PARAGRAPH
MUST BE SPECIFIED IN IDENTIFICATION DIVISION.
C:\COBOL650\SmallestProgram.cob 7: JMN1019I-W  INDICATOR AREA MUST
CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
C:\COBOL650\SmallestProgram.cob 7: JMN1005I-W  CHARACTER STRING 'P' MUST
START IN AREA B. ASSUMED TO START IN AREA B.
C:\COBOL650\SmallestProgram.cob 7: JMN1004I-W  RESERVED WORD 'RUN' MUST
START IN AREA B. ASSUMED TO START IN AREA B.
STATISTICS: HIGHEST SEVERITY CODE=S, PROGRAM UNIT=1


Hope that makes sense to you, doesnt to me :(


Ben



Frederico Fonseca wrote:
> On Sun, 19 Sep 2004 11:56:28 +0000 (UTC), Ben Hall
> <Ben@NOSAPMSkyBlueConnections.co.uk> wrote:
>
> 
>
>
> Snip code.
>
> The error each compiler is issuing would be very important to know.
> 
>
> Withouth the error it is just guessing, but I think you may need to
> tell the compiler which one is the main program.
>
> Try option main in the first line of your program.
>  @OPTION MAIN
> 
>
>
>
>
> Frederico Fonseca
> ema il: frederico_fonseca at syssoft-int.com

Report this thread to moderator Post Follow-up to this message
Old Post
Ben Hall
09-19-04 08:55 PM


Re: Unable to compile
Im running Windows XP SP1 if that makes any difference.

Report this thread to moderator Post Follow-up to this message
Old Post
Ben Hall
09-19-04 08:55 PM


Re: Unable to compile
I quickly glanced at the messages.
To me it seems that eventhough you specified
$ SET SOURCEFORMAT"FREE"
that the compiler does not accept free format or does not process the
compiler options correctly or the compiler options are incorrect!

..I might be wrong though!

Why don't you try the "classic" A+B area coding style first (this will
only take a minute assuming the programs are very small) and see if you
can get a clean compile.

Then test (= run) your program.

And, if it works, then try free format.
(it might then be the case that certain compiler options have to be
(re)set differently).


Regards, Wim Ahlers.


Report this thread to moderator Post Follow-up to this message
Old Post
wahlers
09-19-04 08:55 PM


Re: Unable to compile
Please don't top post.
That was corrected.
On Sun, 19 Sep 2004 12:54:11 +0000 (UTC), Ben Hall
<Ben@NOSAPMSkyBlueConnections.co.uk> wrote:

>Frederico Fonseca wrote: 

>Ok this is what happens when I try and compile SmallestProgram.cob
>
>Start Run cmd
>cobol - press esc,  enter SmallestProgram, press esc
>dir
>still only displays the cobol compiler and smallestprogram - no obj or
>msg files.
>
>When going via the Fujitsu one
>
>Programming staff > tools > wincob
>select smallestprogram > options > add mail to compile as main program
>Compile > error
>
snip
>DIVISION.
>C:\COBOL650\SmallestProgram.cob 2: JMN1104I-S  PROGRAM-ID PARAGRAPH IS
>MISSING. PROGRAM-NAME GENERATED BY SYSTEM.
>C:\COBOL650\SmallestProgram.cob 2: JMN1019I-W  INDICATOR AREA MUST
>CONTAIN '-','*','/','D',OR BLANK. A BLANK IS ASSUMED TO BE SPECIFIED.
>C:\COBOL650\SmallestProgram.cob 2: JMN1041I-W  SEPARATOR MUST FOLLOW
>CHARACTER STRING. SEPARATOR ASSUMED.
snip

It seems that the
$ SET SOURCEFORMAT"FREE"
option is not being considered.

I don't have V3 installed long time ago, so I can't try it/look at
manual.

I would advise you to use the standard A/B format, as it is possible
that V3 does not allow this.

>
>
>Hope that makes sense to you, doesnt to me :(
>
>
>Ben
>
>
>



Frederico Fonseca
ema il: frederico_fonseca at syssoft-int.com

Report this thread to moderator Post Follow-up to this message
Old Post
Frederico Fonseca
09-19-04 08:55 PM


Re: Unable to compile
On Sun, 19 Sep 2004 12:54:11 +0000 (UTC), Ben Hall
<Ben@NOSAPMSkyBlueConnections.co.uk> wrote:

>Ok this is what happens when I try and compile SmallestProgram.cob
>

>When going via the Fujitsu one
>
>Programming staff > tools > wincob
>select smallestprogram > options > add mail to compile as main program
>Compile > error
>
>** DIAGNOSTIC MESSAGE ** (NOPRGMID)
>C:\COBOL650\SmallestProgram.cob 0: JMN1102I-S  IDENTIFICATION DIVISION
>HEADER IS MISSING. HEADER ASSUMED TO BE CODED.

Add a line at the top with this starting in column 8:

@OPTIONS SRF(FREE,FREE)

$SET SOURCEFORMAT is wrong for Fujitsu, that's a  Micro Focus option.

Report this thread to moderator Post Follow-up to this message
Old Post
Robert Wagner
09-19-04 08:55 PM


Re: Unable to compile
On Sun, 19 Sep 2004 11:56:28 +0000 (UTC), Ben Hall
<Ben@NOSAPMSkyBlueConnections.co.uk> wrote:

>Hello,
>I'm new to cobol, just want to see what the lang is like, compile a few
>programs, learn syntax etc.

You might consider zero-suppressing the result and using a case
statement.

01  result  pic z9.

evaluate operator
when '+'
compute result = Num1 + Num2
when '*'
compute result = Num1 * Num2
when other
display 'Do not understand ' operator
end-evaluate




Report this thread to moderator Post Follow-up to this message
Old Post
Robert Wagner
09-19-04 08:55 PM


Re: Unable to compile
is there any chance someone could send me working code for the Fujitsu
or COBOL650 compiler just so I can test to make sure the actual compiler
works.

Cheers


Robert Wagner wrote:
> On Sun, 19 Sep 2004 11:56:28 +0000 (UTC), Ben Hall
> <Ben@NOSAPMSkyBlueConnections.co.uk> wrote:
>
> 
>
>
> You might consider zero-suppressing the result and using a case
> statement.
>
> 01  result  pic z9.
>
> evaluate operator
>     when '+'
>        compute result = Num1 + Num2
>     when '*'
>        compute result = Num1 * Num2
>     when other
>        display 'Do not understand ' operator
> end-evaluate
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Ben Hall
09-19-04 08:55 PM


Re: Unable to compile
Ben Hall wrote:
> is there any chance someone could send me working code for the Fujitsu
> or COBOL650 compiler just so I can test to make sure the actual compiler
> works.

(Make sure these columns line up - if you're not sure of what the layout
means, look up "area A" or "margin A" on Google - I'm sure it will
easily become apparent.

columns
000000000111
123456789012
identification division.
program-id.  compilerTest.
procedure division.
testMe.
display "it worked"
stop run.

This is untested, but I'm pretty sure it will work.  If you're using
Fujitsu, be sure to go into the compiler options and add "MAIN", or
you'll get an error during link about no entry point.  If you're
learning, I'd advise you to skip free-format - but that's just me; I'm
sure others would advise you otherwise.

Mr. Wagner's suggestion of @OPTION should correct the error on your
calculator program, though - have you tried it?  In that case, you'd
have your *own* program that would make sure the compiler works.  :)


--
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~
~   /   \  /         ~        Live from Montgomery, AL!       ~
~  /     \/       o  ~                                        ~
~ /      /\   -   |  ~          LXi0007@Netscape.net          ~
~ _____ /  \      |  ~ http://www.knology.net/~mopsmom/daniel ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~         I do not read e-mail at the above address           ~
~    Please see website if you wish to contact me privately   ~
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
~ GEEKCODE 3.12 GCS/IT d s-:+ a C++ L++ E--- W++ N++ o? K- w$ ~
~ !O M-- V PS+ PE++ Y? !PGP t+ 5? X+ R* tv b+ DI++ D+ G- e    ~
~ h---- r+++ z++++                                            ~
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~


Report this thread to moderator Post Follow-up to this message
Old Post
LX-i
09-20-04 01:55 AM


Sponsored Links




Last Thread Next Thread Next
Pages (2): [1] 2 »
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:16 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.