|
Jon,
Try using
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 VENDR1.
03 VR1.
05 VNID PIC X(6).
05 VNNAME PIC X(30).
EXEC SQL END DECLARE SECTION END-EXEC.
The precompiler will not recognize working storage fields unless they are
inside of the Declare section.
Jerry Thomas
Cothern Computer Systems.
-----Original Message-----
From: cobol400-l-admin@midrange.com
[mailto:cobol400-l-admin@midrange.com]On Behalf Of Jon Paris
Sent: Tuesday, July 30, 2002 8:21 PM
To: Cobol400-L@Midrange. Com
Subject: Problems with Insert in Embedded SQL
I know this is going to be a duh! when I find the answer but .... I posted
an earlier version of this question on the Midrange list but thought that
since it appears that the problem is likely Cobol specific .....
This code compiles OK:
Working-Storage Section.
Exec SQL
Include SQLCA
End-Exec.
01 VENDR1.
03 VR1.
05 VNID PIC X(6).
05 VNNAME PIC X(30).
Procedure Division.
Exec SQL
Insert into VendSmall
Values(:VR1)
End-Exec.
Of course when I add this second structure
*01 VENDR2.
* 03 VR1.
* 05 VNID PIC X(6).
* 05 VNNAME PIC X(30).
The compile fails because VR1 is not unique. My understanding is that I
should be able to code the Values clause as:
Values(:VENDR1.VR1)
and everything should be fine. Try telling that to the pre-compiler. It
insists that VENDR1 and VR1 are "not defined or not usable. In fact I get
this error even when the second structure is removed. I've read the
manuals, checked the archives, and can't find a thing - I'm hoping someone
here will have an answer.
PS. This code is a simplification of the problem - I'm really trying to use
data definitions generated by COPY DDS.
Also posted in the SQL area just in case !!
Jon Paris
Partner400
_______________________________________________
This is the COBOL Programming on the iSeries/AS400 (COBOL400-L) mailing list
To post a message email: COBOL400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/cobol400-l
or email: COBOL400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/cobol400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.