IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 Select statement in COBOL Report Writer


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
taciturn

New User


Joined: 27 Aug 2007
Posts: 3
Location: Philippines

PostPosted: Thu Mar 12, 2009 2:58 am
Reply with quote

Hi!

Does anyone know if a COBOL Report Writer program can contain a select db2 statement?

I'm planning to edit a pgm but they said it has a report writer code . I'm not sure actually if it has a difference with the 'normal' cobol code.

Thanks!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 12, 2009 4:32 am
Reply with quote

Hello and welcome to the forum,

I am not aware of anything that prohibits the use of sql and report-writer in the same module.

Suggest it would be an easy experiment to add a simple count(*) to the program and run the compile/test
Back to top
View user's profile Send private message
taciturn

New User


Joined: 27 Aug 2007
Posts: 3
Location: Philippines

PostPosted: Fri Mar 13, 2009 2:28 am
Reply with quote

Thanks Dick!

I tried what you suggested and i got this:

IGYPS0225-S An "EXEC SQL" statement was found, but the "SQL" compiler option was not
1PP 5655-G53 IBM Enterprise COBOL for z/OS 3.4.1
in effect. The statement was discarded.

... it looks like it doesn't support SQL.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Fri Mar 13, 2009 2:34 am
Reply with quote

Well, if the compiler found an EXEC SQL then the DB2 pre-processer hasn't been run on the program first.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Mar 13, 2009 2:53 am
Reply with quote

Or the sql option wasn't enabled to use the DB2 precompiler in the Enterprise Compiler. This has nothing to do with the report writer which isn't supported in the Enterprise Compiler.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Mar 13, 2009 3:41 am
Reply with quote

Hello,

Quote:
This has nothing to do with the report writer which isn't supported in the Enterprise Compiler.
I recall the Report Writer being removed form the compiler, but thought it was now an add-on product that would still work with Enterprise cobol.

Is the add-on still available? Will it work with Enterprise cobol?

Quote:
it looks like it doesn't support SQL.
Suggest you speak with someone in your group that compiles db2 programs and have them show you the standard cobol/db2 compile proces you should use now that the program includes sql. As was mentioned, the db2 pre-compiler must be used. Once the current error is resolved, the report writer may or may not work.

Keep us posted icon_smile.gif
Back to top
View user's profile Send private message
Terry Heinze

JCL Moderator


Joined: 14 Jul 2008
Posts: 1249
Location: Richfield, MN, USA

PostPosted: Fri Mar 13, 2009 9:54 am
Reply with quote

According to publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/igy3lr30/APPENDIX1.7?ACTION=MATCHES&REQUEST=report+writer&TYPE=FUZZY&SHELF=&DT=20050714120224&CASE=&searchTopic=TOPIC&searchText=TEXT&searchIndex=INDEX&rank=RANK&ScrollTOP=FIRSTHIT#FIRSTHIT it is.
Back to top
View user's profile Send private message
taciturn

New User


Joined: 27 Aug 2007
Posts: 3
Location: Philippines

PostPosted: Fri Mar 13, 2009 11:29 pm
Reply with quote

Hello!

Here's what happened:

I compiled the pgm using db2 precompile and the error for the sql compiler was resolved. but I got a new error:

PP 5655-G53 IBM Enterprise COBOL for z/OS 3.4.1
1350 IGYPS2121-S "SQLCA" was not defined as a data-name. The statement was discarded

Originally, the COMPILE PARMS of the pgm is:

COMPILE PARMS ===> EX(INX(RW),PRTX(RW)),DYNAM

I removed the PARMS and recompiled. The SQLCA error was gone but I received another error:

364 IGYDS0148-S "REPORT" is a reserved word related to language not supported

Now, I'm not sure what to place on the compile parms that will work for report writer and db2...

If all else fails, I'll just create a separate new pgm for db2. icon_smile.gif

Thanks All!
Back to top
View user's profile Send private message
Mickeydusaor

Active User


Joined: 24 May 2006
Posts: 258
Location: Salem, Oregon

PostPosted: Sat Mar 14, 2009 12:20 am
Reply with quote

For DB2 you also need to do the following:

EXEC SQL INCLUDE SQLCA END-EXEC
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Sat Mar 14, 2009 12:26 am
Reply with quote

Hello,

Quote:
1350 IGYPS2121-S "SQLCA" was not defined as a data-name.
Does the code include:
Code:
     EXEC SQL                                     
          INCLUDE SQLCA                           
     END-EXEC.                                     
I'm not sure why the removed parms would have an affect on the sqlca definition.

Suggest you check with the system support people who maintain the compile jcl to make sure you are using the proper steps/parameters.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top