 




<?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: batching qsh sftp fails when using a variable for script</title>
	<atom:link href="http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/</link>
	<description></description>
	<lastBuildDate>Sat, 25 May 2013 17:28:03 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
	<item>
		<title>By: The most-watched IT questions: April 12, 2012 - ITKE Community Blog</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/#comment-106751</link>
		<dc:creator>The most-watched IT questions: April 12, 2012 - ITKE Community Blog</dc:creator>
		<pubDate>Mon, 16 Apr 2012 03:03:52 +0000</pubDate>
		<guid isPermaLink="false">#comment-106751</guid>
		<description><![CDATA[[...] 4. Several community members come together as they try to solve BDLmichael&#8217;s problem solving a iSeries command error. [...]]]></description>
		<content:encoded><![CDATA[<p>[...] 4. Several community members come together as they try to solve BDLmichael&#8217;s problem solving a iSeries command error. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/#comment-105483</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Fri, 30 Mar 2012 23:42:18 +0000</pubDate>
		<guid isPermaLink="false">#comment-105483</guid>
		<description><![CDATA[&lt;i&gt;There is more code, but...&lt;/i&gt;

Ah. Not exactly out of context, just misinterpreted by me. Now I see the alternative interpretation. In that case, there&#039;s no need for my related comment.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>There is more code, but&#8230;</i></p>
<p>Ah. Not exactly out of context, just misinterpreted by me. Now I see the alternative interpretation. In that case, there&#8217;s no need for my related comment.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wpoulin</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/#comment-105469</link>
		<dc:creator>wpoulin</dc:creator>
		<pubDate>Fri, 30 Mar 2012 14:50:32 +0000</pubDate>
		<guid isPermaLink="false">#comment-105469</guid>
		<description><![CDATA[Tom,

You took my statement out of context.  My full statement was;

&lt;i&gt;There is more code, but I didn’t think it related to executing QSH in batch and with a variable.&lt;/i&gt;

Thank You,
Bill Poulin]]></description>
		<content:encoded><![CDATA[<p>Tom,</p>
<p>You took my statement out of context.  My full statement was;</p>
<p><i>There is more code, but I didn’t think it related to executing QSH in batch and with a variable.</i></p>
<p>Thank You,<br />
Bill Poulin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/#comment-105438</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Fri, 30 Mar 2012 00:23:36 +0000</pubDate>
		<guid isPermaLink="false">#comment-105438</guid>
		<description><![CDATA[&lt;i&gt;This command expects a null terminated parameter&lt;/i&gt;

It&#039;s already known that a null-terminator is not needed. The QSH command works fine without one as demonstrated by the OP&#039;s working example. The issue is in the difference between using a literal for the QSH command parameter and a variable. Because QSH is a system command, it has no need for a null-terminator.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>This command expects a null terminated parameter</i></p>
<p>It&#8217;s already known that a null-terminator is not needed. The QSH command works fine without one as demonstrated by the OP&#8217;s working example. The issue is in the difference between using a literal for the QSH command parameter and a variable. Because QSH is a system command, it has no need for a null-terminator.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mmanley</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/#comment-105429</link>
		<dc:creator>mmanley</dc:creator>
		<pubDate>Thu, 29 Mar 2012 14:38:05 +0000</pubDate>
		<guid isPermaLink="false">#comment-105429</guid>
		<description><![CDATA[You probably need to trim the string, and append a X&#039;00&#039; to the end.  This command expects a null terminated parameter]]></description>
		<content:encoded><![CDATA[<p>You probably need to trim the string, and append a X&#8217;00&#8242; to the end.  This command expects a null terminated parameter</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/#comment-105409</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Wed, 28 Mar 2012 22:37:12 +0000</pubDate>
		<guid isPermaLink="false">#comment-105409</guid>
		<description><![CDATA[&lt;i&gt;...I didn’t think it related to executing QSH in batch and with a variable.&lt;/i&gt;

It&#039;s definitely related when extra quotes are added that shouldn&#039;t be there.

But the idea of using a literal or a variable is sound. Just don&#039;t put quotes in the variable that aren&#039;t present in the literal.

Tom]]></description>
		<content:encoded><![CDATA[<p><i>&#8230;I didn’t think it related to executing QSH in batch and with a variable.</i></p>
<p>It&#8217;s definitely related when extra quotes are added that shouldn&#8217;t be there.</p>
<p>But the idea of using a literal or a variable is sound. Just don&#8217;t put quotes in the variable that aren&#8217;t present in the literal.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wpoulin</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/#comment-105403</link>
		<dc:creator>wpoulin</dc:creator>
		<pubDate>Wed, 28 Mar 2012 15:02:52 +0000</pubDate>
		<guid isPermaLink="false">#comment-105403</guid>
		<description><![CDATA[It should be ZSFTP is the command.

Bill]]></description>
		<content:encoded><![CDATA[<p>It should be ZSFTP is the command.</p>
<p>Bill</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: wpoulin</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/#comment-105402</link>
		<dc:creator>wpoulin</dc:creator>
		<pubDate>Wed, 28 Mar 2012 15:01:35 +0000</pubDate>
		<guid isPermaLink="false">#comment-105402</guid>
		<description><![CDATA[This can work, I have a similar job that runs thru the Job Scheduler,
Here is a snippet of the code, maybe an example will help,
ZFTP is a command that executes a CL by the same name;
ZSFTP      HOST(***.nh.gov) SCRIPT(&#039;/tmp/lowmo&#039;) +
             USER(&#039;******&#039;)                        

 PGM        PARM(&amp;HOST &amp;SCRIPT &amp;USER)              
                                                   
 DCL        VAR(&amp;HOST)   TYPE(*CHAR) LEN(15)       
 DCL        VAR(&amp;SCRIPT) TYPE(*CHAR) LEN(15)       
 DCL        VAR(&amp;USER)   TYPE(*CHAR) LEN(15)       
                                                   
 DCL        VAR(&amp;CMD)       TYPE(*CHAR) LEN(500)   

ADDENVVAR  ENVVAR(SFTP_USER) VALUE(&amp;USER) REPLACE(*YES) 
ADDENVVAR  ENVVAR(SFTP_HOST) VALUE(&amp;HOST) REPLACE(*YES) 
                                                        
CHGVAR     VAR(&amp;CMD) +                                  
             VALUE(&#039;PATH=$PATH:/QOpenSys/usr/bin &amp;&amp; +   
             sftp -b&#039; *BCAT &amp;SCRIPT *TCAT &#039;.sftp +      
             $SFTP_USER@$SFTP_HOST 22&#039;)                 

QSH        CMD(&amp;CMD) 

Again this is run in batch thru the Job Scheduler.  There is more code, but I didn&#039;t think it related to executing QSH in batch and with a variable.

Hope this helps,
Bill Poulin]]></description>
		<content:encoded><![CDATA[<p>This can work, I have a similar job that runs thru the Job Scheduler,<br />
Here is a snippet of the code, maybe an example will help,<br />
ZFTP is a command that executes a CL by the same name;<br />
ZSFTP      HOST(***.nh.gov) SCRIPT(&#8216;/tmp/lowmo&#8217;) +<br />
             USER(&#8216;******&#8217;)                        </p>
<p> PGM        PARM(&amp;HOST &amp;SCRIPT &amp;USER)              </p>
<p> DCL        VAR(&amp;HOST)   TYPE(*CHAR) LEN(15)<br />
 DCL        VAR(&amp;SCRIPT) TYPE(*CHAR) LEN(15)<br />
 DCL        VAR(&amp;USER)   TYPE(*CHAR) LEN(15)       </p>
<p> DCL        VAR(&amp;CMD)       TYPE(*CHAR) LEN(500)   </p>
<p>ADDENVVAR  ENVVAR(SFTP_USER) VALUE(&amp;USER) REPLACE(*YES)<br />
ADDENVVAR  ENVVAR(SFTP_HOST) VALUE(&amp;HOST) REPLACE(*YES) </p>
<p>CHGVAR     VAR(&amp;CMD) +<br />
             VALUE(&#8216;PATH=$PATH:/QOpenSys/usr/bin &amp;&amp; +<br />
             sftp -b&#8217; *BCAT &amp;SCRIPT *TCAT &#8216;.sftp +<br />
             $SFTP_USER@$SFTP_HOST 22&#8242;)                 </p>
<p>QSH        CMD(&amp;CMD) </p>
<p>Again this is run in batch thru the Job Scheduler.  There is more code, but I didn&#8217;t think it related to executing QSH in batch and with a variable.</p>
<p>Hope this helps,<br />
Bill Poulin</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tomliotta</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/#comment-105374</link>
		<dc:creator>tomliotta</dc:creator>
		<pubDate>Tue, 27 Mar 2012 20:08:08 +0000</pubDate>
		<guid isPermaLink="false">#comment-105374</guid>
		<description><![CDATA[...using three single quotes...

Why would you put three quotes there? I&#039;ve never tested it, but what happens when you put quotes around a command on a QSH command line?

If I try this:&lt;pre&gt;===&gt; &#039;ls /home/toml&#039;&lt;/pre&gt;
...to list my /home directory in a QSH session, I get this error:&lt;ul&gt;
	&lt;li&gt;qsh: 001-0014 Command ls /home/toml not found.&lt;/li&gt;
&lt;/ul&gt;
QSH thinks that the entire quoted string is the name of the command.

Your &amp;CMDSHL value should probably only have single quotes.

Tom]]></description>
		<content:encoded><![CDATA[<p>&#8230;using three single quotes&#8230;</p>
<p>Why would you put three quotes there? I&#8217;ve never tested it, but what happens when you put quotes around a command on a QSH command line?</p>
<p>If I try this:
<pre>===&gt; 'ls /home/toml'</pre>
<p>&#8230;to list my /home directory in a QSH session, I get this error:
<ul>
<li>qsh: 001-0014 Command ls /home/toml not found.</li>
</ul>
<p>QSH thinks that the entire quoted string is the name of the command.</p>
<p>Your &amp;CMDSHL value should probably only have single quotes.</p>
<p>Tom</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bdlmichael</title>
		<link>http://itknowledgeexchange.techtarget.com/itanswers/batching-qsh-sftp-fails-when-using-a-variable-for-script/#comment-105368</link>
		<dc:creator>bdlmichael</dc:creator>
		<pubDate>Tue, 27 Mar 2012 15:55:19 +0000</pubDate>
		<guid isPermaLink="false">#comment-105368</guid>
		<description><![CDATA[Hi again - 

the CL command is

CHGVAR  &amp;CMDSHL (&#039;&#039;&#039;/QOpenSys/usr/bin/sftp -v -b +  
      /home/WIRM123/sftpcmd.txt wirm123@sftp2.123&#039;&#039;&#039;)

using three single quotes

the string from the debug session is as below ( 200 type character string ) 

&#039;/QOpenSys/usr/bin/sftp -v -b /home/WIRM123/sftpcmd.txt  wirm123@sftp2.123&#039;                   

the CL code to execute ( and fails) is 

SBMJOB CMD(QSH CMD( &amp;CMDSHL ))   JOB(SSHJOB) USER(WIRM123)

the sftpcmd.txt is is a simple text file


cd Share/5501/test/5501updt                                                                
ls                                                                                          
put MGG1.TXT MGG1.TXT                                                                       
ls                                                                                          
exit                                                                                        

this all works when I make the hardcoded call as below 

SBMJOB CMD(QSH CMD(&#039;/QOpenSys/usr/bin/sftp -v -b  +        
                /home/WIRM123/sftpcmd.txt +               
               wirm123@sftp2.123&#039;))              +   
                                 JOB(SSHJOB) USER(WIRM5501)

but I want to be able to provide different directories and such as this is in a generic CL 

intersting problem - but I&#039;ve reached the end of my skills as far as what to be able to test.]]></description>
		<content:encoded><![CDATA[<p>Hi again &#8211; </p>
<p>the CL command is</p>
<p>CHGVAR  &amp;CMDSHL (&#8221;&#8217;/QOpenSys/usr/bin/sftp -v -b +<br />
      /home/WIRM123/sftpcmd.txt <a href="mailto:wirm123@sftp2.123">wirm123@sftp2.123</a>&#8221;&#8217;)</p>
<p>using three single quotes</p>
<p>the string from the debug session is as below ( 200 type character string ) </p>
<p>&#8216;/QOpenSys/usr/bin/sftp -v -b /home/WIRM123/sftpcmd.txt  <a href="mailto:wirm123@sftp2.123">wirm123@sftp2.123</a>&#8216;                   </p>
<p>the CL code to execute ( and fails) is </p>
<p>SBMJOB CMD(QSH CMD( &amp;CMDSHL ))   JOB(SSHJOB) USER(WIRM123)</p>
<p>the sftpcmd.txt is is a simple text file</p>
<p>cd Share/5501/test/5501updt<br />
ls<br />
put MGG1.TXT MGG1.TXT<br />
ls<br />
exit                                                                                        </p>
<p>this all works when I make the hardcoded call as below </p>
<p>SBMJOB CMD(QSH CMD(&#8216;/QOpenSys/usr/bin/sftp -v -b  +<br />
                /home/WIRM123/sftpcmd.txt +<br />
               <a href="mailto:wirm123@sftp2.123">wirm123@sftp2.123</a>&#8216;))              +<br />
                                 JOB(SSHJOB) USER(WIRM5501)</p>
<p>but I want to be able to provide different directories and such as this is in a generic CL </p>
<p>intersting problem &#8211; but I&#8217;ve reached the end of my skills as far as what to be able to test.</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.012 seconds using memcached
Object Caching 394/397 objects using memcached

Served from: itknowledgeexchange.techtarget.com @ 2013-05-25 19:56:36 -->