×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




I'd start be debugging it outside of CL because that may be confusing
things. For example, take a look at the following...

chgvar var(&cmd) value('PATH=$PATH:/QOpenSys/usr/bin+
:/QOpenSys/usr/local/bin
&& +
expect -df ' *cat &imp_impscript)

The above will result in:
PATH=$PATH:/QOpenSys/usr/bin:QOpenSys/usr/local/bin && expect -df
<scriptfilename>

It appears the script file has a shebang call to "expect" within it
(i.e. #!/usr/local/bin/expect -f). So you've duplicated efforts by having
reference to "expect" in two places. Remove it from one of them.


Aaron Bartell
litmis.com - Services for open source on IBM i


On Tue, Jul 12, 2016 at 10:13 AM, Mary Kurtenbach <
mary.kurtenbach@xxxxxxxxxxxxxxxxx> wrote:

Can anyone help me? I am getting this message (the one in the subject
line) in the log from expect.

From the job, I get:

40 07/08/16 11:45:28.424776 QP2SHELL2 QSYS *STMT
QP0ZEXEC QS
From module . . . . . . . . : QP2SHELL2
From procedure . . . . . . : send_message__FPcT1PvUi
Statement . . . . . . . . . : 11
To module . . . . . . . . . : QP0ZEXECUT
To procedure . . . . . . . : run__14Qp0zExecutableFv
Statement . . . . . . . . . : 6
Message . . . . : PASE for i ended for signal 6, error code 1.
Cause . . . . . : The PASE for i program ended because of PASE for i
signal

I have searched and searched the internet to find how to use variables
with expect and it does not work here. I was able to get sftp to work at
my last job but I built the sftp command line and ran a batch job from
there. This is my first experience with expect and I must say, it is
getting the better of me. Thanks in advance for any help.

PGM PARM(&JOBN)

DCL VAR(&JOBN) TYPE(*CHAR) LEN(10)
DCL VAR(&cmd) TYPE(*CHAR) LEN(500)
DCLF FILE(IMPINFO) OPNID(IMP)

LOOP:
RCVF OPNID(IMP)
MONMSG MSGID(CPF0864) EXEC(GOTO CMDLBL(ENDPGM))
if (&imp_impjobn *EQ &jobn) do
ADDENVVAR ENVVAR(SSH_USER) VALUE(&imp_impusr) REPLACE(*YES)
ADDENVVAR ENVVAR(SSH_HOST) VALUE(&imp_imphost) REPLACE(*YES)
ADDENVVAR ENVVAR(SSH_PASS) VALUE(&imp_imppwd) REPLACE(*YES)
ADDENVVAR ENVVAR(SSH_SCRIPT) VALUE(&imp_impscript)
REPLACE(*YES*)
ADDENVVAR ENVVAR(SSH_FILE) VALUE(&imp_impfilen)
REPLACE(*YES)
chgvar var(&cmd) value('PATH=$PATH:/QOpenSys/usr/bin+
:/QOpenSys/usr/local/bin
&& +
expect -df ' *cat &imp_impscript)

ADDENVVAR ENVVAR(QIBM_QSH_CMD_OUTPUT) +
value('FILE=/tmp/expect.log') +
REPLACE(*YES)

ADDENVVAR ENVVAR(QIBM_QSH_CMD_ESCAPE_MSG) value(Y) +
REPLACE(*YES)


qsh cmd(&CMD)
monmsg MSGID(QSH0000) EXEC(DO)
sndmsg msg('File transfer failed! See /tmp/expect.log') +
tousr(MARYK)

enddo
goto endpgm
enddo
goto loop

ENDPGM:
ENDPGM


#!/usr/local/bin/expect -f
set timeout 20
spawn sftp $env(SSH_USER)@$env(SSH_HOST)
expect 'password: "
send "$env(SSH_PASS)\n"
expect "sftp>"
send "lcd /home/SFSH\n"
expect "sftp>"
send "get $env(SSH_FILE)\n"
expect "sftp>"
send "ls -l\n"
expect "sftp>"
send "quit\n"
exit 0

Call me frustrated!




Mary Kurtenbach | System Programmer/Analyst
Delta Dental of South Dakota
720 N. Euclid Ave., Pierre, SD 57501
605-224-7345 | 800-627-3961
Direct Line: 605-494-2517
E-mail: mary.kurtenbach@xxxxxxxxxxxxxxxxx<mailto:
mary.kurtenbach@xxxxxxxxxxxxxxxxx>

[http://www.deltadentalsd.com/DDSDlogo.jpg]<http://www.deltadentalsd.com/>
[http://www.deltadentalsd.com/FB22.png] <
https://www.facebook.com/DeltaDentalSD> [
http://www.deltadentalsd.com/Twitter22.png] <
https://twitter.com/deltadentalsd> [
http://www.deltadentalsd.com/Pin22.png] <
https://www.pinterest.com/deltadentalSD/> [
http://www.deltadentalsd.com/blog22.png] <http://blog.deltadentalsd.com/>
[http://www.deltadentalsd.com/Li22.png] <
https://www.linkedin.com/company/delta-dental-of-south-dakota> [
http://www.deltadentalsd.com/YouTube22.png] <
https://www.youtube.com/user/DeltaDentalSD> [
http://www.deltadentalsd.com/g22.png] <
https://plus.google.com/+DeltadentalsdInsurance/about>



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

Please contact support@xxxxxxxxxxxx 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-2026 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.