Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Programing structure of cobol+db2 in mainframes

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests
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    Post subject: Programing structure of cobol+db2 in mainframes
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    Post subject:
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    Post subject: syantax of cobol/db2 program
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    Post subject:
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    Post subject: compile and run jcl for cobol/db2 pgm
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    IBMMAINFRAMES.com Support Forums -> HomeWorks & Requests All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts RULES(NOEVENPACK) in cobol jackzhang75 COBOL Programming 5 Wed Mar 29, 2017 12:47 am
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts Submit job from Cobol with input data abdulrafi COBOL Programming 4 Wed Feb 01, 2017 12:41 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us