View previous topic :: View next topic |
Author |
Message |
hari_uss Beginner
Joined: 19 Dec 2002 Posts: 78 Topics: 6 Location: Trivandrum, India
|
Posted: Tue Mar 04, 2003 12:41 pm Post subject: DECLARATIVES for a COBOL/DB2 program |
|
|
I have to use DECLARATIVE in a Cobol/DB2 program. Program executes under IMS as DL/I batch.
When I compile the program, DB2 pre-compiler puts DSNSQL SECTION just after PROCEDURE DIVISION. In the next step, my cobol compiler complains that DECLARATIVE is not immediately following PROCEDURE DIVISION.
Is there any way to work around this problem?
Thanks, |
|
Back to top |
|
|
hari_uss Beginner
Joined: 19 Dec 2002 Posts: 78 Topics: 6 Location: Trivandrum, India
|
Posted: Sat Mar 08, 2003 4:42 pm Post subject: |
|
|
Seems no body ever experienced this issue. Anyway, I solved it as follows:
I had the DECLARATIVE as:
Code: |
PROCEDURE DIVISION.
DECLARATIVES.
USER-HEADER-LABEL SECTION.
USE AFTER STANDARD BEGINNING FILE LABEL
PROCEDURE ON DTL-TAPE01.
SUBMISSION-MOVE.
MOVE USER-LABEL TO DATE-DETAIL.
END DECLARATIVES.
|
That is, when the file DTL-TAPE01 is opened in INPUT mode, I have to get the LABEL value and store it in a working storage variable.
I avoided the DECLARATIVEs and wrote the move statement just after
OPEN INPUT DTL-TAPE01. |
|
Back to top |
|
|
Glenn Beginner
Joined: 23 Mar 2003 Posts: 56 Topics: 3
|
Posted: Sun Mar 23, 2003 6:13 am Post subject: |
|
|
Personally I would separate the programs. Make the DB2 code a subroutine which is called by the DL/I program...no muss, no fuss on the incompatibilities of the two working together...usually a good idea to not intermix this stuff if you can't help it...
It's hard enough sometimes to figure how to set up the JCL to make all of this stuff work together without worrying about making the source work as well... |
|
Back to top |
|
|
|
|