×
The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.
Robert,
The problem you are having is that you are attempting to reference a locally defined field in your SQL statement.
The SQL precompiler does not recognize locally defined fields, only global values.
Jeff Young
Sr. Programmer Analyst
IBM -e(logo) server Certified Systems Exper - iSeries Technical Solutions V5R2
IBM Certified Specialist- e(logo) server i5Series Technical Solutions Designer V5R3
IBM Certified Specialist- e(logo)server i5Series Technical Solutions Implementer V5R3
----- Original Message ----
From: "RNewton@xxxxxxxxxxxx" <RNewton@xxxxxxxxxxxx>
To: rpg400-l@xxxxxxxxxxxx
Sent: Friday, December 7, 2007 12:10:32 PM
Subject: SQL Precompiler Woes
Hi all,
I am having an issue compiling my module with embedded SQL inside of
procedures that reference the incoming parameter of the procedure defined
as a likeds that points to an externally described datastructure based on a
null pointer.
Confused? Ya me too, let me explain...
BTW: This is on V5R4
The procedure accepts a data structure externally described as a physical
file as its only parameter. Since I cannot do an "e ds extname" in a
prototype or parameter interface definition, you must do it as a seperate d
spec then do a likeds() on your parameter definition. However when I do
this the SQL precompiler gives messages that the subfields of the parameter
that I am referencing are not defined or not usable.
I know of the problem in the precompiler having to do with scoping (it does
not see scope at all), but this doesn't appear to be related to that. When
I look at the compile listing I see that the externally described
datastructure is being defined. Here is a snippet:
FIELD1 35 TIME(8) IN MYDS
FIELD1 **** COLUMN
142
FIELD1 **** IN PR_REC
197
If it's defined in pr_rec according to whats above, then why does it also
say that it is not defined or usable?
MSG ID SEV RECORD TEXT
SQL0312 30 103 Position 39 Variable FIELD1 not defined or not usable.
SQL0312 30 104 Position 39 Variable FIELD2 not defined or not usable
SQL0312 30 105 Position 39 Variable FIELD3 not defined or not usable.
I have pasted in a simplified version of the module that illustrates my
issue. If anyone can offer any insight into this, I would greatly
appreciate it.
Here is a generalized version of the module source:
===================================================================
**********************************************************************
* Mod Date...........:
* Mod By.............:
* Project #..........:
* Mod Tag............:
* Mod Description....:
*---------------------------------------------------------------
* Name : ClassName_WriteToFile
* Description : Write a record into the MYFILE table
* Argument(s) : Externally described as MYFILE
* Return value : The primary key auto incremented by the database
* Usage : value = ClassName_WriteToFile(myLocalFile_ds);
*---------------------------------------------------------------
// BEGIN PROCEDURE
p Class_WriteToFile...
p b export
// Procedure Interface
//////////////////////////////////
d Class_WriteToFile...
d pi 30s 0
d pr_rec likeds(myds)
// Define Local Vars
//////////////////////////////////
d AutoIncValue s 30s 0
Robert Newton
EDPS
Electronic Data Processing Services
Software Engineer
rnewton@xxxxxxxxxxxxxxxxx
This communication is confidential and is intended to be privileged. If
there is a problem with this transmission, please contact the sender. If
the reader of this message is not the intended recipient, or the employee
or agent responsible to deliver it to the intended recipient, you are
hereby notified that any dissemination, distribution or copying of this
communication is strictly prohibited.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.