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

Programing structure of cobol+db2 in mainframes


IBM Mainframe Forums -> HomeWorks & Requests
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
venkateswara rao.muppa

New User


Joined: 21 May 2007
Posts: 5
Location: hyderabad

PostPosted: Tue Jun 05, 2007 10:17 am
Reply with quote

hi, this is venkat
please reply me the programing structure of cobol+db2 in mainframes
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Tue Jun 05, 2007 10:31 am
Reply with quote

Your question is very generic, I hope you want to know the essentials of a COBOL/DB2 program . Even a program which just gets a current date from DB2 can also be considered a COBOL/DB2 program. The structure depends on the complexity of the queries that are involved . You need to include the SQLCA in working storage area. If you have more than one row meeting the selection criteria then you have to first decalre a cursor in the working storage section, open the cursor, fetch the same and process the rows in a loop and close the cursor. While compiling you will have to use a precompiler like DSNHPC to compile the SQL code , compile the COBOL using IGYCRCTL, linkedit using IEWL or HEWL, bind the plan and run the program using IKJEFT01.

Should you need any more information do not hesitate to ask
Back to top
View user's profile Send private message
venkateswara rao.muppa

New User


Joined: 21 May 2007
Posts: 5
Location: hyderabad

PostPosted: Tue Jun 05, 2007 10:52 am
Reply with quote

hi,prasad v r k thanks for giving reply.
i am learner of mf. could you please give the syntax of program.
Back to top
View user's profile Send private message
prasadvrk

Active User


Joined: 31 May 2006
Posts: 200
Location: Netherlands

PostPosted: Tue Jun 05, 2007 3:54 pm
Reply with quote

Quote:
i am learner of mf. could you please give the syntax of program.


If you mean the source code of program please find the same for a simple COBOL/DB2 program below, offcourse you have to validate the return codes where ever necessary.:


IDENTIFICATION DIVISION.
PROGRAM-ID. COBDB2.

AUTHOR. PRASAD VEMULAPALLI.
DATE-WRITTEN. JUNE 2007.
DATE-COMPILED.
ENVIRONMENT DIVISION.

INPUT-OUTPUT SECTION.
FILE-CONTROL.
SELECT OUTFILE ASSIGN TO PRINTF.

DATA DIVISION.
FILE SECTION.
FD OUTFILE EXTERNAL
BLOCK 0 RECORDS.
01 OUTFILE-REC PIC X(132).

WORKING-STORAGE SECTION.
77 WS-EMPCODE PIC S(9).
EXEC SQL INCLUDE SQLCA END-EXEC.

EXEC SQL
DECLARE CURSOR C1 FOR
SELECT EMPCODE FROM EMP WHERE EMPNAME = 'PRASAD'
END-EXEC.

PROCEDURE DIVISION.

OPEN OUTPUT OUTFILE

EXEC SQL
OPEN CURSOR C1
END-EXEC.

PERFORM FETCH-PARA UNTIL SQLCODE=+100.

CLOSE OUTFILE
STOP RUN.

FETCH-PARA.

EXEC SQL
FETCH CURSOR C1 INTO :WS-EMPCODE
END-EXEC
WRITE OUTREC FROM WS-EMP-CODE .
Back to top
View user's profile Send private message
venkateswara rao.muppa

New User


Joined: 21 May 2007
Posts: 5
Location: hyderabad

PostPosted: Tue Jun 05, 2007 5:25 pm
Reply with quote

hi,Prasad V R K garu thanks for giving reply.
could you please reply compile jcl and run jcl for this cobol/db2 pgm.
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 -> HomeWorks & Requests

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts SH256/MD5 Checksum in Mainframes JCL JCL & VSAM 14
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top