For Programmers: Free Programming Magazines  


Home > Archive > Cobol > September 2006 > Micro Focus COBOL Compiler Questions









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Micro Focus COBOL Compiler Questions
js-acus

2006-09-21, 7:55 am

We are using Micro Focus COBOL for Unix V4.1 revision 030 and have a
few questions.

1) Our documentation for the compiler has gone missing for whatever
reason. Does anyone know where replacement doco can be obtained?
Electronic or dead tree would be fine. I looked on the Micro Focus
website but couldn't find anything useful.

2) We are linking third party COBOL code with a main program written in
C. Unfortunately, the COBOL is using "STOP RUN" rather than
"EXIT". This prevents the remainder of the C code from executing.
We have the right to modify the COBOL code but our manager is reluctant
to take on the additional maintenance. Is there a compiler option to
change the interpretation of "STOP RUN" to "EXIT"?

3) What is the best way to return a status code from the COBOL to the C
code?

Thanks, Jim

James J. Gavan

2006-09-21, 6:55 pm

js-acus wrote:
> We are using Micro Focus COBOL for Unix V4.1 revision 030 and have a
> few questions.
>
> 1) Our documentation for the compiler has gone missing for whatever
> reason. Does anyone know where replacement doco can be obtained?
> Electronic or dead tree would be fine. I looked on the Micro Focus
> website but couldn't find anything useful.
>
> 2) We are linking third party COBOL code with a main program written in
> C. Unfortunately, the COBOL is using "STOP RUN" rather than
> "EXIT". This prevents the remainder of the C code from executing.
> We have the right to modify the COBOL code but our manager is reluctant
> to take on the additional maintenance. Is there a compiler option to
> change the interpretation of "STOP RUN" to "EXIT"?
>
> 3) What is the best way to return a status code from the COBOL to the C
> code?
>
> Thanks, Jim
>

I don't do Unix - so not quite sure which compatible current compiler
you are using. But a good starting point would be the Mixed-Language
examples that Alain Reymond just referred to in the other message about
Micro Focus.

Language-wise take a look at the on-line manuals for Net Express V 4.0 -
syntax for STOP RUN or EXIT PROGRAM likely are compatible for Unix :-

http://supportline.microfocus.com/s...40/nx40indx.htm

Bring up the first of the Language Reference Manuals and search for
syntax on STOP RUN and EXIT PROGRAM.

Possibly your current program reads something like :-

Procedure Division.

perform OPEN-FILES
perform PROCESS-FILES
perform CLOSE FILES

STOP RUN.

OPEN-FILES.

move "xxxx" to filename
open Input Customer-File
etc......

Taking above Procedure Division - if it didn't have that line STOP RUN
then the program would drop through and attempt to perform the
OPEN-FILES paragraph, for a second time.

It should be no more difficult than substituting EXIT PROGRAM for STOP RUN.

Check the docs - a COBOL program can have a RETURN-CODE, associated with
the EXIT PROGRAM statement - now check those mixed language examples for
the format that C is expecting back from the called COBOL program.

If you want a set of your missing manuals - check the microfocus.com
site and get the contact for your local sales office. They can check if
they are available - if not available, likely they will suggest you buy
the latest and greatest - at a price !

Jimmy, Calgary AB
Richard

2006-09-21, 6:55 pm


js-acus wrote:
> We are using Micro Focus COBOL for Unix V4.1 revision 030 and have a
> few questions.
>
> 1) Our documentation for the compiler has gone missing for whatever
> reason. Does anyone know where replacement doco can be obtained?
> Electronic or dead tree would be fine. I looked on the Micro Focus
> website but couldn't find anything useful.


It should all be on the CD.

> 2) We are linking third party COBOL code with a main program written in
> C. Unfortunately, the COBOL is using "STOP RUN" rather than
> "EXIT". This prevents the remainder of the C code from executing.


'EXIT' by itself is a noise word, a place holder, a no-op. You wouild
need to replace it with 'EXIT PROGRAM' which is equivalent to return.

> We have the right to modify the COBOL code but our manager is reluctant
> to take on the additional maintenance. Is there a compiler option to
> change the interpretation of "STOP RUN" to "EXIT"?


No. But 'GOBACK' is an IBMism that will do either depending on whether
it was CALLed or not.

> 3) What is the best way to return a status code from the COBOL to the C
> code?


Usually return values are put in a passed parameter. There are
extensions that allow a value to be returned.

William M. Klein

2006-09-21, 6:55 pm

See below

--
Bill Klein
wmklein <at> ix.netcom.com
"js-acus" <jshillington@acus.com> wrote in message
news:1158846303.377882.24860@e3g2000cwe.googlegroups.com...
> We are using Micro Focus COBOL for Unix V4.1 revision 030 and have a
> few questions.
>
> 1) Our documentation for the compiler has gone missing for whatever
> reason. Does anyone know where replacement doco can be obtained?
> Electronic or dead tree would be fine. I looked on the Micro Focus
> website but couldn't find anything useful.


See if:
http://supportline.microfocus.com//...42/oc42indx.htm
gives you what you want

>
> 2) We are linking third party COBOL code with a main program written in
> C. Unfortunately, the COBOL is using "STOP RUN" rather than
> "EXIT". This prevents the remainder of the C code from executing.
> We have the right to modify the COBOL code but our manager is reluctant
> to take on the additional maintenance. Is there a compiler option to
> change the interpretation of "STOP RUN" to "EXIT"?


It's not very pretty, but if you use the ocmpiler directives:

MAKESYN "STOP" == "GOBACK"
MAKESYN "RUN" == "CONTINUE"

I think it will do wha tyou want. (There are better ways with changing the
source code, but if you want a "directive-only" solution, this should do it -
and cause no other changes to run-time behavior.

>
> 3) What is the best way to return a status code from the COBOL to the C
> code?


Depends on how the C-code is expecting to to "come in". The RETURNING phrase
may give you what you want, or possibly MOVE "??" to Return-Code.

>
> Thanks, Jim
>



Richard

2006-09-21, 6:55 pm


William M. Klein wrote:

> MAKESYN "STOP" == "GOBACK"
> MAKESYN "RUN" == "CONTINUE"
>
> I think it will do wha tyou want.


Unless they have a ' STOP "Fix problem and continue"'.

William M. Klein

2006-09-21, 6:55 pm

You're right (of course). On the other hand, how often have YOU seen the

STOP "literal"

statement in actual programs?

--
Bill Klein
wmklein <at> ix.netcom.com
"Richard" <riplin@Azonic.co.nz> wrote in message
news:1158878197.181112.211840@h48g2000cwc.googlegroups.com...
>
> William M. Klein wrote:
>
>
> Unless they have a ' STOP "Fix problem and continue"'.
>



Sergey Kashyrin

2006-09-22, 6:55 pm

Jim,

You can also take a look at CBL_EXIT_PROC function.
Using it you can set C/C++ handler so you can catch an exit attempt from
Cobol program and do longjmp().

Sergey

"js-acus" <jshillington@acus.com> wrote in message
news:1158846303.377882.24860@e3g2000cwe.googlegroups.com...
> We are using Micro Focus COBOL for Unix V4.1 revision 030 and have a
> few questions.
>
> 1) Our documentation for the compiler has gone missing for whatever
> reason. Does anyone know where replacement doco can be obtained?
> Electronic or dead tree would be fine. I looked on the Micro Focus
> website but couldn't find anything useful.
>
> 2) We are linking third party COBOL code with a main program written in
> C. Unfortunately, the COBOL is using "STOP RUN" rather than
> "EXIT". This prevents the remainder of the C code from executing.
> We have the right to modify the COBOL code but our manager is reluctant
> to take on the additional maintenance. Is there a compiler option to
> change the interpretation of "STOP RUN" to "EXIT"?
>
> 3) What is the best way to return a status code from the COBOL to the C
> code?
>
> Thanks, Jim
>



Stephen Gennard

2006-09-22, 6:55 pm

Hi Sergey,



CBL_EXIT_PROC allows you to be notified that the rununit is terminating..
ie: it has already started to shutdown.



Performing a longjmp() in the middle of this would not be wise idea as not
all of resources have been shutdown.



Also, entering COBOL again after the longjmp() would also be problematic
too, because the runtime would be in a unknown state!


--
Stephen

"Sergey Kashyrin" <ska@resqnet.com> wrote in message
news:%WXQg.33$KP7.107626@news.sisna.com...
> Jim,
>
> You can also take a look at CBL_EXIT_PROC function.
> Using it you can set C/C++ handler so you can catch an exit attempt from
> Cobol program and do longjmp().
>
> Sergey
>
> "js-acus" <jshillington@acus.com> wrote in message
> news:1158846303.377882.24860@e3g2000cwe.googlegroups.com...
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com