I have to correct something I said before. I took the *AUTO out of the DIM(*AUTO:9999) keyword in the declaration and it still barfed the same message. So it has nothing to do with *AUTO.

Also, I have /exactly and precisely/ (redundant for emphasis) the same syntax in another regular *PGM program and it has been running smoothly for a long time.

What I don't get is how an SQL pre-compiler can get error out on a variable definition conflict when there is only one. (for the SQL statement variable used to "Prepare" the cursor.

definition conflict  two different definitions for something out of one definition.

- Alan


On 1/20/2023 10:39 AM, Alan Cassidy wrote:
Thanks, Charles!

I don't know whether it's relevant at this stage, but this all happens in the context of a service program procedure.

*SQL0314 Sev=35 Record=2297 Text = Position 40 Host variable QQSTMT not unique.*

*SQL5011 sev=30 Record=2301Text = Position 67 Host structure array MX not defined or not usable for reason code 1. *


In the calcs I build a dynamic SQL statement in variable QQSTMT to use in the normal SQL cursor.

==>As I wrote this I realized that it might be caused by the other error SQL0314.

BIG problem with SQL0314 is that I only find once that QQSTMT is defined. I suspect that issue is elsewhere but it gives me no clue.


*DCL-DS MT EXTNAME(CS58V004) END-DS ;*

**

*DCL-DS MX EXTNAME(CS58V004)DIM(9999) ;*

**

*DCL-S QQSTMT CHAR(4098) ;*

**


*2297 exec SQL Prepare STMT1 from :QQSTMT *

**

*exec SQL Declare M1 cursor for STMT1 ;;*

**

*exec SQL Open M1;*

**

*2301 exec SQL Fetch Next From M1 for :RowsToFetch rows into :MX ;*

--Alan

P. S.I wrestled with the SQL5011 error before. Reading the text for it, looks like 12 different possible causes for it. The last time it happened for me I posted a please-help, but other changes in the code resolved the issue, and I couldn't figure out which change did it.

=============================

On 1/19/2023 6:08 PM, Charles Wilt wrote:
Need to see where it's being used

Charles

On Thu, Jan 19, 2023 at 3:03 PM Alan Cassidy<cfuture@xxxxxxxxxxx>  wrote:

In coding a service procedure as a sort-of I/O server.

I have defined a data structure to receive rows from an SQL View:

DCL-DS   MX  EXTNAME( MYSQLVIEW )  DIM(*AUTO:9999) ;

..where

This exact syntax works perfectly elsewhere without the *AUTO.

I'm getting error SQL5011  Host structure array MX not defined or not
usable for reason code 1.

Reason code 1: Host structure array not defined or is not a valid
structure. A valid structure must have at least one valid member....

Can somebody help or point me somewhere. I saw something similar before
so I suspect it's not the *AUTO throwing things off.

-Alan Cassidy


--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email:MIDRANGE-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:https://lists.midrange.com/mailman/listinfo/midrange-l
or email:MIDRANGE-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
athttps://archive.midrange.com/midrange-l.

Please contactsupport@xxxxxxxxxxxxxxxxxxxx  for any subscription related
questions.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.