Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DECLARATIVES for COBOL/DBW program

Status
Not open for further replies.

hariuss

Programmer
Jan 26, 2003
3
IN
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,
 
It may not be convenient, but you could run the DB2 pre-compiler first and then edit the output from that to add the DECLARATIVE section ahead of the DSNSQL section. You'd have to do this every time you needed to compile the program so it'd be a real maintenance nightmare, but...

Actually, I'd be curious to know what you needed the DECLARATIVE section for. I'd try to eliminate the need for the DECLARATIVE first, but I have no experience in a DB2/IMS environment, so I'm really not qualified to speak to that environment. "Code what you mean,
and mean what you code!
But by all means post your code!"

Razalas
 
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 is opened in INPUT mode, I have to get the LABEL value and store it in a working storage variable.

I'm planning to avoid the use of DECLARATIVE for this. I may code the move statement just after opening the file, rather. (Hopes that will work!)

Thanks,

 
Could you create a non-DB2/non-IMS driver program that opens the tape file and gets the label data (via the DECLARATIVE) and then calls the DB2/IMS program passing that label data to it as part of the calling parameters? "Code what you mean,
and mean what you code!
But by all means post your code!"

Razalas
 
It is possible and easy, I agree. But I don't have choice. I'm working on an old program, and changing it to read from DB2 instead of a flat file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top