<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Query Manager Error</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/query-manager-error/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/query-manager-error/</link>
	<description></description>
	<lastBuildDate>Wed, 19 Jun 2013 04:33:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: a1maida</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/query-manager-error/#comment-81566</link>
		<dc:creator>a1maida</dc:creator>
		<pubDate>Thu, 16 Sep 2010 14:20:07 +0000</pubDate>
		<guid isPermaLink="false">#comment-81566</guid>
		<description><![CDATA[It worked!
Thank you Tom for your solution!]]></description>
		<content:encoded><![CDATA[<p>It worked!<br />
Thank you Tom for your solution!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/query-manager-error/#comment-81526</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Wed, 15 Sep 2010 20:14:56 +0000</pubDate>
		<guid isPermaLink="false">#comment-81526</guid>
		<description><![CDATA[Ah! That CL example explains better what you&#039;re trying to do. Here, try it this way:&lt;pre&gt;
pgm  ( &amp;MISC# )

   dcl   &amp;MISC#       *dec  (  4 0 )
   dcl   &amp;MISC        *char    4

   chgvar      &amp;MISC        &amp;MISC#

   strqmqry    qmqry( AXMTESTLIB/SANQMCON1 ) output( * ) +
                 setvar( ( MISC &amp;MISC ) )

   monmsg    ( QWM2701 ) exec( RETURN )

END:
  return

endpgm&lt;/pre&gt;
I reformatted for readability and made a couple simple changes.

Your &amp;MISC# variable is being passed as a numeric parm, and that&#039;s fine as long as it was generated in the calling program as *DEC (4 0) or a compatible data type in a different language. But when it is used by the STRQMQRY command, it needs to be a series of character digits.

We do that by creating a *CHAR variable that is 4 bytes long and letting the CHGVAR command do a straight conversion. Bear in mind that the CL variable named &amp;MISC has no relationship at all with your QM replacement variable of the same name. It&#039;s probably not a good idea to use the same name for both, but it will work. It just brings potential confusion when errors come up.

I also got rid of the ALWQRYDFN() parameter. Since you&#039;re creating a QM query, you don&#039;t want some *QRYDFN object of the same name getting into this. I&#039;d make other changes, but they aren&#039;t actually required for this question.

And your QM query statement becomes something like:&lt;pre&gt;
SELECT bcbgcd COLHDG(&quot;MISC&quot; &quot;CODE&quot;),
       somecolumn LEN(4,0) COLHDG(&quot;SHARED CONTAINER&quot; &quot;CODE&quot;) NAME(MISC)
  FROM lmbcrela
    WHERE bcbgcd=&amp;MISC&lt;/pre&gt;
I replaced the &quot;&amp;MISC&quot; for the second column with a column name of &quot;somecolumn&quot;, though I &lt;i&gt;think&lt;/i&gt; I can see why you had it there. If you really wanted a column from a table, then use the name of that column. You might even put &amp;MISC back and have it work. It doesn&#039;t make much sense, though, for this SELECT statement since the same value is going to show up in the bcbgcd column anyway. Your WHERE clause guarantees that both columns will be nothing but repeats of the value in &amp;MISC -- if 1000 rows match, then that value will display 2000 times and nothing else will show up.

I assume that you will develop the SELECT statement over time to make it more meaningful. This should get you closer.

Tom]]></description>
		<content:encoded><![CDATA[<p>Ah! That CL example explains better what you&#8217;re trying to do. Here, try it this way:
<pre>
pgm  ( &amp;MISC# )

   dcl   &amp;MISC#       *dec  (  4 0 )
   dcl   &amp;MISC        *char    4

   chgvar      &amp;MISC        &amp;MISC#

   strqmqry    qmqry( AXMTESTLIB/SANQMCON1 ) output( * ) +
                 setvar( ( MISC &amp;MISC ) )

   monmsg    ( QWM2701 ) exec( RETURN )

END:
  return

endpgm</pre>
<p>I reformatted for readability and made a couple simple changes.</p>
<p>Your &amp;MISC# variable is being passed as a numeric parm, and that&#8217;s fine as long as it was generated in the calling program as *DEC (4 0) or a compatible data type in a different language. But when it is used by the STRQMQRY command, it needs to be a series of character digits.</p>
<p>We do that by creating a *CHAR variable that is 4 bytes long and letting the CHGVAR command do a straight conversion. Bear in mind that the CL variable named &amp;MISC has no relationship at all with your QM replacement variable of the same name. It&#8217;s probably not a good idea to use the same name for both, but it will work. It just brings potential confusion when errors come up.</p>
<p>I also got rid of the ALWQRYDFN() parameter. Since you&#8217;re creating a QM query, you don&#8217;t want some *QRYDFN object of the same name getting into this. I&#8217;d make other changes, but they aren&#8217;t actually required for this question.</p>
<p>And your QM query statement becomes something like:
<pre>
SELECT bcbgcd COLHDG("MISC" "CODE"),
       somecolumn LEN(4,0) COLHDG("SHARED CONTAINER" "CODE") NAME(MISC)
  FROM lmbcrela
    WHERE bcbgcd=&amp;MISC</pre>
<p>I replaced the &#8220;&amp;MISC&#8221; for the second column with a column name of &#8220;somecolumn&#8221;, though I <i>think</i> I can see why you had it there. If you really wanted a column from a table, then use the name of that column. You might even put &amp;MISC back and have it work. It doesn&#8217;t make much sense, though, for this SELECT statement since the same value is going to show up in the bcbgcd column anyway. Your WHERE clause guarantees that both columns will be nothing but repeats of the value in &amp;MISC &#8212; if 1000 rows match, then that value will display 2000 times and nothing else will show up.</p>
<p>I assume that you will develop the SELECT statement over time to make it more meaningful. This should get you closer.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: a1maida</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/query-manager-error/#comment-81519</link>
		<dc:creator>a1maida</dc:creator>
		<pubDate>Wed, 15 Sep 2010 16:22:39 +0000</pubDate>
		<guid isPermaLink="false">#comment-81519</guid>
		<description><![CDATA[With SETVAR you cann&#039;t pass numeric parameters.]]></description>
		<content:encoded><![CDATA[<p>With SETVAR you cann&#8217;t pass numeric parameters.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: a1maida</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/query-manager-error/#comment-81483</link>
		<dc:creator>a1maida</dc:creator>
		<pubDate>Tue, 14 Sep 2010 11:51:14 +0000</pubDate>
		<guid isPermaLink="false">#comment-81483</guid>
		<description><![CDATA[I am trying to compile this CLP:    
100-              PGM        PARM(&amp;MISC#)                               
    102-              DCL        VAR(&amp;MISC#) TYPE(*DEC) LEN(4 0)            
    103-              DCL        VAR(&amp;MISC) TYPE(*DEC) LEN(4 0)             
    122-                                                                    
    128-              STRQMQRY   QMQRY(AXMTESTLIB/SANQMCON1) OUTPUT(*) +    
    130                            ALWQRYDFN(*YES) SETVAR((&amp;MISC &amp;MISC#))   
* CPD0776 30  Variable &amp;MISC for parameter SETVAR must be *CHAR.            
* CPD0776 30  Variable &amp;MISC# for parameter SETVAR must be *CHAR.           
    133-                                                                    
    137-              MONMSG MSGID(QWM2701) EXEC(RETURN)                    
    138-                                                                    
   2900-  END:        RETURN]]></description>
		<content:encoded><![CDATA[<p>I am trying to compile this CLP:<br />
100-              PGM        PARM(&amp;MISC#)<br />
    102-              DCL        VAR(&amp;MISC#) TYPE(*DEC) LEN(4 0)<br />
    103-              DCL        VAR(&amp;MISC) TYPE(*DEC) LEN(4 0)<br />
    122-<br />
    128-              STRQMQRY   QMQRY(AXMTESTLIB/SANQMCON1) OUTPUT(*) +<br />
    130                            ALWQRYDFN(*YES) SETVAR((&amp;MISC &amp;MISC#))<br />
* CPD0776 30  Variable &amp;MISC for parameter SETVAR must be *CHAR.<br />
* CPD0776 30  Variable &amp;MISC# for parameter SETVAR must be *CHAR.<br />
    133-<br />
    137-              MONMSG MSGID(QWM2701) EXEC(RETURN)<br />
    138-<br />
   2900-  END:        RETURN</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: narasimhareddy</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/query-manager-error/#comment-81482</link>
		<dc:creator>narasimhareddy</dc:creator>
		<pubDate>Tue, 14 Sep 2010 10:20:23 +0000</pubDate>
		<guid isPermaLink="false">#comment-81482</guid>
		<description><![CDATA[First item, Can we execute 2 sql statements thru one QMQRY ?

What do you want to achieve thru Set statement ? The one you provided specifies nothing. The Set should be used to set connection or set transaction.]]></description>
		<content:encoded><![CDATA[<p>First item, Can we execute 2 sql statements thru one QMQRY ?</p>
<p>What do you want to achieve thru Set statement ? The one you provided specifies nothing. The Set should be used to set connection or set transaction.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/query-manager-error/#comment-81471</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 14 Sep 2010 07:27:22 +0000</pubDate>
		<guid isPermaLink="false">#comment-81471</guid>
		<description><![CDATA[&lt;i&gt;I am trying to pass a numeric parameter.&lt;/i&gt;

Fine. Then pass a numeric parameter. It&#039;s not a problem.

But what is the SET statement for? You already have a replacement variable in the WHERE clause that would receive your numeric parameter. You don&#039;t need a SET statement for anything. The value will be set when you run the STRQMQRY command.

Also, you have &amp;MISC at the beginning of statement 0008.00. It doesn&#039;t seem appropriate there, especially if it&#039;s going to be a numeric value. You need to replace &amp;MISC in statement 0008.00 with a column name from your table.

(Or are you trying to reference the ordinal column number?)

Maybe the best thing would be if you showed us what you want your final SQL statement to look like when it executes.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>I am trying to pass a numeric parameter.</i></p>
<p>Fine. Then pass a numeric parameter. It&#8217;s not a problem.</p>
<p>But what is the SET statement for? You already have a replacement variable in the WHERE clause that would receive your numeric parameter. You don&#8217;t need a SET statement for anything. The value will be set when you run the STRQMQRY command.</p>
<p>Also, you have &amp;MISC at the beginning of statement 0008.00. It doesn&#8217;t seem appropriate there, especially if it&#8217;s going to be a numeric value. You need to replace &amp;MISC in statement 0008.00 with a column name from your table.</p>
<p>(Or are you trying to reference the ordinal column number?)</p>
<p>Maybe the best thing would be if you showed us what you want your final SQL statement to look like when it executes.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: a1maida</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/query-manager-error/#comment-81417</link>
		<dc:creator>a1maida</dc:creator>
		<pubDate>Mon, 13 Sep 2010 13:56:55 +0000</pubDate>
		<guid isPermaLink="false">#comment-81417</guid>
		<description><![CDATA[I am trying to pass a numeric parameter.]]></description>
		<content:encoded><![CDATA[<p>I am trying to pass a numeric parameter.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/query-manager-error/#comment-81377</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Fri, 10 Sep 2010 20:45:38 +0000</pubDate>
		<guid isPermaLink="false">#comment-81377</guid>
		<description><![CDATA[I don&#039;t quite understand what you are trying to do. If this is a QM query, then what is this statement doing in there:&lt;pre&gt;
0001.00 SET MISC :MISC6&lt;/pre&gt;
SET &lt;variable&gt; isn&#039;t a valid QM query statement. And if it was, it wouldn&#039;t have a syntax that looked that way. What are you trying to do?

Tom]]></description>
		<content:encoded><![CDATA[<p>I don&#8217;t quite understand what you are trying to do. If this is a QM query, then what is this statement doing in there:
<pre>
0001.00 SET MISC :MISC6</pre>
<p>SET &lt;variable&gt; isn&#8217;t a valid QM query statement. And if it was, it wouldn&#8217;t have a syntax that looked that way. What are you trying to do?</p>
<p>Tom</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 6/9 queries in 0.011 seconds using memcached
Object Caching 366/369 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-06-19 07:42:57 -->