View previous topic :: View next topic |
Author |
Message |
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue Nov 02, 2004 10:42 am Post subject: Shortest COBOL program (Again!) |
|
|
Hi all,
Can anyone tell me what is so special about this COBOL program without actually compiling it? Yes. Only compilation.
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. ERRMSG.
STOP RUN .
|
Will it compile successfully?
If not, what will be compilation messages?
8) _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Nov 02, 2004 10:51 am Post subject: |
|
|
Cogito,
If I remember correctly ERRMSG is used to generate the compiler listing with explanations. is that Right?
It will compile successfully.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue Nov 02, 2004 12:01 pm Post subject: |
|
|
100% !
It compiles successfully. And, yes, it generates a list of various compiler messages.
Kolusu, you are great! _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
mok Beginner
Joined: 16 May 2003 Posts: 12 Topics: 0 Location: paris
|
Posted: Tue Nov 09, 2004 1:19 pm Post subject: |
|
|
Hi,
ERRMSG exists since Cobol II ! Furthermore, you can do it shorter : the STOP RUN statement is not mandatory.
Cheers |
|
Back to top |
|
|
Kathi Beginner
Joined: 14 May 2003 Posts: 25 Topics: 0 Location: Mission Viejo, California
|
Posted: Tue Dec 28, 2004 1:52 am Post subject: |
|
|
I think some people have too much time on their hands! |
|
Back to top |
|
|
ranga_subham Intermediate
Joined: 31 Jan 2006 Posts: 255 Topics: 72
|
Posted: Sun Feb 25, 2007 3:12 am Post subject: |
|
|
Hi, mok.
Quote: |
ERRMSG exists since Cobol II ! Furthermore, you can do it shorter : the STOP RUN statement is not mandatory.
|
Would you please explain in detail?
TIA. _________________ Ranga
*****
None of us is as smart as all of us - Ken Blanchard |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Sun Feb 25, 2007 10:42 am Post subject: |
|
|
ranga_subham,
If control reaches the end of the Procedure Division of a method, and there is no next executable statement, an implicit EXIT METHOD statement is executed. ie the control is returned to the system. So if you don't have an explicit STOP RUN statement and the control reaches the end, then the program automatically execuetes the implicit exit method and return the control which is what mok is saying.
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
peaglet Beginner
Joined: 08 Jun 2007 Posts: 2 Topics: 0 Location: Chicago
|
Posted: Mon Jun 11, 2007 4:58 pm Post subject: |
|
|
If you're still using STOP RUN you need to move up to the newest compiler. GOBACK is now the standard |
|
Back to top |
|
|
balaji.p.raman Beginner
Joined: 27 Feb 2007 Posts: 10 Topics: 5 Location: India
|
Posted: Thu Sep 02, 2010 7:17 am Post subject: |
|
|
Well, I hope you guys would be shooting me for posting this!
The shortest COBOL program I have managed to write was this
"PROGRAM-ID. SHORT."
Compiler used: Fujitsu NetCOBOL for Windows!
No kidding!
Reason:
A file input is treated to be a COBOL input file ONLY when it is identified with an IDENTIFICATION DIVISION. However, if one forgets just that small bit and a COBOL verb PROGRAM-ID follows, this compiler works around and recognizes the file as a valid COBOL file.
Can someone confirm if IBM compilers exhibit this behavior? _________________ Rgds,
Balaji |
|
Back to top |
|
|
Anuj Dhawan Intermediate
Joined: 19 Jul 2007 Posts: 298 Topics: 7 Location: Mumbai,India
|
Posted: Thu Sep 02, 2010 8:08 am Post subject: |
|
|
No that will not work on zOS. For IBM Enterprise COBOL for z/OS 3.4.1 you get this error Code: | IGYDS1000-E A "IDENTIFICATION DIVISION" header was not found in this program. It was assumed present. | and program does not compile successfully. _________________ Regards,
Anuj |
|
Back to top |
|
|
|
|