IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

What is minimal coding to run a program


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
mahaes

New User


Joined: 04 Jul 2006
Posts: 6

PostPosted: Wed Jul 12, 2006 11:05 am
Reply with quote

what is minimal coding to run a program...

ie we have code all the four divisions.........
Back to top
View user's profile Send private message
sivaram.ch

New User


Joined: 28 Jun 2005
Posts: 11

PostPosted: Wed Jul 12, 2006 11:42 am
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Jul 12, 2006 1:24 pm
Reply with quote

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
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1353
Location: Israel

PostPosted: Wed Jul 12, 2006 1:29 pm
Reply with quote

But then again, the program is never executed, it's just for validation.
Back to top
View user's profile Send private message
chiranjeevi_mca

New User


Joined: 19 Feb 2006
Posts: 27

PostPosted: Thu Jul 27, 2006 11:34 am
Reply with quote

in vscobol II


id division.
program-id. hai.
procedure division.
stop run.
Back to top
View user's profile Send private message
shivaleela

New User


Joined: 27 Jul 2006
Posts: 3

PostPosted: Sat Jul 29, 2006 1:30 am
Reply with quote

Finally, whats the correct answer for this post?
can we run a pgm without the procedure division?



regs
shivaleela
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Sat Jul 29, 2006 1:48 am
Reply with quote

The minimum requirement is:
Code:

       IDENTIFICATION DIVISION. 
       PROCEDURE DIVISION.       
           GOBACK.               
Back to top
View user's profile Send private message
satish_r84

New User


Joined: 31 Jul 2006
Posts: 6

PostPosted: Mon Jul 31, 2006 2:49 pm
Reply with quote

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
View user's profile Send private message
khannay2k

New User


Joined: 24 Feb 2005
Posts: 28
Location: Bangalore

PostPosted: Tue Aug 01, 2006 10:53 am
Reply with quote

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
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Mon Aug 14, 2006 4:12 pm
Reply with quote

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
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Mon Aug 14, 2006 5:20 pm
Reply with quote

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
View user's profile Send private message
Sridevi_C

Active User


Joined: 22 Sep 2005
Posts: 104
Location: Concord, New Hampshire, USA.

PostPosted: Wed Aug 16, 2006 12:33 am
Reply with quote

Satish,
GOBACK can be used in COBOL -DB2 program's also.
Thanks
Back to top
View user's profile Send private message
mahaes

New User


Joined: 04 Jul 2006
Posts: 6

PostPosted: Mon Aug 21, 2006 2:29 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Using API Gateway from CICS program CICS 0
No new posts DB2 Event passed to the Application P... DB2 1
No new posts How to pass the PARM value to my targ... COBOL Programming 8
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
Search our Forums:

Back to Top