Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: AIX COBOL set 1.1 using UDB - help on compilation
Thanks.
Yes, I do understand the INCLUDE being resolved by pre-compiler and COPY
being resolved by the compiler. But, in manframes, host-variables that are
outside of INCLUDEs(say variables under working storage) just works fine
and the pre-compiler doesn't flag any messages for this.

According to igyapg00.pdf COBOL for AIX Programming Guide Version 2.0,

"You can identify host variables used on SQL statements without using EXEC
SQL BEGIN DECLARE SECTION and EXEC SQL END DECLARE SECTION statements"

But I'm not able to pass thru pre-compilation without using them for the
host variables. Is that begin declare/end declare mandatory then?

sample code that I tried to compile:
IDENTIFICATION DIVISION.
PROGRAM-ID.    "TESTSQL".
ENVIRONMENT DIVISION.
CONFIGURATION SECTION.
INPUT-OUTPUT SECTION.
FILE-CONTROL.
DATA DIVISION.
FILE SECTION.
WORKING-STORAGE SECTION.
*EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 WS-OPT PIC S9(9) COMP-5.
01 WS-NAME.
49 WS-NAME-LEN PIC S9(4) COMP-5.
49 WS-NAME-DATA PIC X(128).
*EXEC SQL END DECLARE SECTION END-EXEC.
EXEC SQL
INCLUDE SQLCA
END-EXEC.
PROCEDURE DIVISION.
0000-MAIN SECTION.
DISPLAY 'START'.
MOVE 'FILEPGM' TO WS-NAME.
EXEC SQL
SELECT QUERYOPT INTO :WS-OPT FROM SYSIBM.SYSPLAN
WHERE NAME = :WS-NAME
FETCH FIRST 1 ROWS ONLY
END-EXEC.
DISPLAY 'SQLCODE=' SQLCODE.
DISPLAY 'OPT=  ' WS-OPT.
DISPLAY 'STOP'.
STOP RUN.
0000-EXIT.
EXIT.

Error message(when not using the begin declare/end declare for a host
variable in working storage):

LINE    MESSAGES FOR testsql.sqb
-----------------------------------------------------------
SQL0060W  The "COBOL" precompiler is in progress.
24   SQL4942N  The statement selects an incompatible data type into
host variable ":WS-OPT".  SQLSTATE=42806
SQL0095N  No bind file was created because of previous errors.
SQL0091W  Precompilation or binding was ended with "2" errors and
"0" warnings.

When the exec sql begin/end declare is used, the (pre)compilation is fine
and the program executes successfully.
Any hints would be helpful.thanks!


Report this thread to moderator Post Follow-up to this message
Old Post
kprasann
09-06-04 08:55 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:03 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.