View previous topic :: View next topic
|
Author |
Message |
mahaes
New User
Joined: 04 Jul 2006 Posts: 6
|
|
|
|
what is minimal coding to run a program...
ie we have code all the four divisions......... |
|
Back to top |
|
|
sivaram.ch
New User
Joined: 28 Jun 2005 Posts: 11
|
|
|
|
yes we do have .A standard cobol program consists of 4 divisions.
IDENTIFICATION DIVISION.
PROGRAM-ID.
ENVIRONMENT DIVISION.
DATA DIVISION.
PROCEDURE DIVISION.
MAIN.
STOPRUN. |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
Where I work, somebody wrote an EXEC to validate copybooks.
The exec just adds:
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. DUMMY.
DATA DIVISION.
WORKING-STORAGE SECTION. |
before the COPY statement then run the compiler.
It seems PROCEDURE DIVISION is not even mandatory! |
|
Back to top |
|
|
Marso
REXX Moderator
Joined: 13 Mar 2006 Posts: 1353 Location: Israel
|
|
|
|
But then again, the program is never executed, it's just for validation. |
|
Back to top |
|
|
chiranjeevi_mca
New User
Joined: 19 Feb 2006 Posts: 27
|
|
|
|
in vscobol II
id division.
program-id. hai.
procedure division.
stop run. |
|
Back to top |
|
|
shivaleela
New User
Joined: 27 Jul 2006 Posts: 3
|
|
|
|
Finally, whats the correct answer for this post?
can we run a pgm without the procedure division?
regs
shivaleela |
|
Back to top |
|
|
superk
Global Moderator
Joined: 26 Apr 2004 Posts: 4652 Location: Raleigh, NC, USA
|
|
|
|
The minimum requirement is:
Code: |
IDENTIFICATION DIVISION.
PROCEDURE DIVISION.
GOBACK.
|
|
|
Back to top |
|
|
satish_r84
New User
Joined: 31 Jul 2006 Posts: 6
|
|
|
|
hey u have mentioned GO BACK statement which is used only in COBOL-IMS programs, till my knowledge is concerned.....
but the thing is that, the control on coming to GO BACK, where does the control go???? |
|
Back to top |
|
|
khannay2k
New User
Joined: 24 Feb 2005 Posts: 28 Location: Bangalore
|
|
|
|
whenever GO BACK command is issued in in a main program(calling pgm) then the control is moved to the operating system, and its MVS here. |
|
Back to top |
|
|
parikshit123
Active User
Joined: 01 Jul 2005 Posts: 269 Location: India
|
|
|
|
Hi,
Just a little correction,
GOBACK takes the control back to where the program is called from.
In case, the program is called directly from JCL/PROC it takes the control back to the JES.
In case, the program is called from another program GOBACK takes the control back to the calling program. |
|
Back to top |
|
|
cobolunni
Active User
Joined: 07 Aug 2006 Posts: 127 Location: kerala,india
|
|
|
|
minimal coding to run a program is
IDENTIFICATION DIVISION.
PROGRAM-ID. NAME.
PROCEDURE DIVISION.
MAIN.
DISPLAY 'HELLO'.
STOP RUN.
DISPLAY statement can be replaced by any statement that can be executed
In the case we only want to compile the program
We can avoid DISPLAY statement
***WRONG ANSWER**** |
|
Back to top |
|
|
Sridevi_C
Active User
Joined: 22 Sep 2005 Posts: 104 Location: Concord, New Hampshire, USA.
|
|
|
|
Satish,
GOBACK can be used in COBOL -DB2 program's also.
Thanks |
|
Back to top |
|
|
mahaes
New User
Joined: 04 Jul 2006 Posts: 6
|
|
|
|
This is the minimal code,
IDENTIFICATION DIVISION
PROGRAM-ID. EXE1.
The minimal code for printing someting on screen is,
IDENTIFICATION DIVISION
PROGRAM-ID. EXE1.
PROCEDURE DIVISION
DISPLAY 'HELLO WORLD'
STOP RUN. |
|
Back to top |
|
|
|