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

Sample Program using Procedure Division Copybook


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

New User


Joined: 04 Jun 2008
Posts: 6
Location: bangalore

PostPosted: Mon Aug 11, 2008 12:07 pm
Reply with quote

Hi friend,

Can anyone post a sample program, which uses procedure division copybook. The copybook has both sequentail and non-sequentail statements.
Back to top
View user's profile Send private message
sri_mf

Active User


Joined: 31 Aug 2006
Posts: 218
Location: India

PostPosted: Mon Aug 11, 2008 12:14 pm
Reply with quote

angi_pri wrote:
Hi friend,

Can anyone post a sample program, which uses procedure division copybook. The copybook has both sequentail and non-sequentail statements.


what do you mean by sequentail and non-sequentail statements
Back to top
View user's profile Send private message
angi_pri

New User


Joined: 04 Jun 2008
Posts: 6
Location: bangalore

PostPosted: Mon Aug 11, 2008 12:31 pm
Reply with quote

We want to have both cobol statements (like Move/add etc) as well as some DB2 SQL statements in a single Procedural copybook. Now If we use INCLUDE in the procedure division will it work? or we need to have two different copybboks one for cobol move statements and the other for DB2 Sql statements?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Mon Aug 11, 2008 1:53 pm
Reply with quote

you need the INCLUDE to insure the copybook is expanded for the db2 pre-compiler.

you can mix in same copybook.
Back to top
View user's profile Send private message
nagamanjari

New User


Joined: 25 Apr 2008
Posts: 9
Location: hyderabad

PostPosted: Wed Aug 20, 2008 12:50 pm
Reply with quote

Hi Dick,
I am also having the problem of including both move statement and some SQL codes within a single procedural copybbok. I tried to INCLUDE the copybook in procedure division like:
MOVE 'UBET440.VTDC_PER_MSTR'
TO WS-TBL-NAME
MOVE 'INSERT' TO WS-OPTION
INCLUDE DB2CPL.
EVALUATE SQLCODE
WHEN 0
CONTINUE

But the copybook is not getting expanded and hence there is compilation error. Compiler is assuming the Include to be procedure name and so not expanding the copybook. Could you kindly throw some light on this issue.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Aug 20, 2008 4:26 pm
Reply with quote

INCLUDE is a DB2 keyword, recognized by the DB2 precompiler.
in COBOL I would code
Code:
EXEC SQL INCLUDE <copybook name> END-EXEC
or
Code:

EXEC SQL
     INCLUDE <copybook name>
END-EXEC



by the way, here is a link for bbcode and how to use it. It will make your code snipets readable:
ibmmainframes.com/faq.php?mode=bbcode
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