MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DECLARATIVES for a COBOL/DB2 program

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
hari_uss
Beginner


Joined: 19 Dec 2002
Posts: 78
Topics: 6
Location: Trivandrum, India

PostPosted: Tue Mar 04, 2003 12:41 pm    Post subject: DECLARATIVES for a COBOL/DB2 program Reply with quote

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
View user's profile Send private message Send e-mail
hari_uss
Beginner


Joined: 19 Dec 2002
Posts: 78
Topics: 6
Location: Trivandrum, India

PostPosted: Sat Mar 08, 2003 4:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Glenn
Beginner


Joined: 23 Mar 2003
Posts: 56
Topics: 3

PostPosted: Sun Mar 23, 2003 6:13 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group