View previous topic :: View next topic
|
Author |
Message |
achusarath
New User
Joined: 21 Mar 2007 Posts: 26 Location: kerala
|
|
|
|
hi ,
i want to run a cobol pgm which calls an embedded sql pgm. so how can i run that pgm. the code is shown below
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. XYZ.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 A PIC 9(2) VALUE IS 10.
01 B PIC 9(2) VALUE IS 04.
01 C PIC 9(2) .
01 D PIC X(10).
PROCEDURE DIVISION.
P1.
COMPUTE C = A + B.
DISPLAY C.
MOVE 'D3COB' TO D.
CALL D.
STOP RUN. |
called pgm
Code: |
IDENTIFICATION DIVISION.
PROGRAM-ID. D3COB.
DATA DIVISION.
WORKING-STORAGE SECTION.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
EXEC SQL
INCLUDE DCLM1
END-EXEC.
01 S1.
49 LEN PIC S9(4) COMP.
49 TXT PIC X(120).
01 C1 PIC S9(3) SIGN LEADING SEPARATE CHARACTER.
PROCEDURE DIVISION.
P1.
MOVE 'UPDATE EMPTABLE1 SET EMPCITY = ? WHERE EMPID=?' TO TXT.
MOVE 51 TO LEN.
MOVE 'NEW' TO EMPCITY.
MOVE 'A2' TO EMPID.
EXEC SQL
PREPARE SQLOBJ FROM :S1
END-EXEC.
EXEC SQL
EXECUTE SQLOBJ USING :EMPCITY,:EMPID
END-EXEC.
MOVE SQLCODE TO C1.
DISPLAY C1.
EXIT-PROGRAM. |
so my question is can we execute a simpl cobol pgm that contain a call stmt which calls a embedded sql pgm. |
|
Back to top |
|
|
mkk157
Active User
Joined: 17 May 2006 Posts: 310
|
|
|
|
Hi achusarath,
Before compiling the Main COBOL program, U need to precompile the sub-program which contains the embedded SQL statements.
Correct me If I am wrong. |
|
Back to top |
|
|
anujageorge
New User
Joined: 28 Mar 2007 Posts: 4 Location: Cochin
|
|
|
|
HI,
but my pgm is not embedded.... only my called pgm is embedded...
so how can we compile with a db2 compiler... |
|
Back to top |
|
|
socker_dad
Active User
Joined: 05 Dec 2006 Posts: 177 Location: Seattle, WA
|
|
|
|
If I understand you correctly, you have a standard COBOL program which calls a DB2 subprogram.
The subprogram has been previously compiled, linked, etc. as a stand alone module.
At our site, our calling programs are compiled, linked and bound under a DB2 package and plan even though they have no SQL in them. According to our systems people, this gives them the ability to call and use these SQL modules. |
|
Back to top |
|
|
priyadutta1984
New User
Joined: 02 Apr 2007 Posts: 11 Location: chennai
|
|
|
|
well,
the sub program which have sql is need to be precompile.once u finish the process then execute main program normal way. no need for precompilation of main program.
cheers
priya |
|
Back to top |
|
|
|