×

Good News Everybody!

The new search engine is LIVE!

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




Here is the code to get the retrun code from sftp back to CL:

0022.00 DCL VAR(&RETURNCODE) TYPE(*INT) LEN(4)



0019.00 DCL VAR(&MSGDTA) TYPE(*CHAR) LEN(4)



0023.00 DCL VAR(&RC) TYPE(*CHAR) LEN(5)



0115.00 MONMSG MSGID(QSH0005 QSH0006 QSH0007) EXEC(DO)

0117.00 RCVMSG MSGTYPE(*LAST) RMV(*NO) MSGDTA(&MSGDTA)

0118.00 CHGVAR VAR(&RETURNCODE) +

0119.00 VALUE(%BIN(&MSGDTA 1 4))

0120.00 CHGVAR VAR(&RC) VALUE(&RETURNCODE)

0121.00 ENDDO



John McKee

On Fri, Feb 3, 2012 at 5:25 PM, Jeff Young <jyoung0950@xxxxxxxxx> wrote:
John,
The program is run under the same user both ways.
Regarding the additional environment variables, I would appreciate it if
you would send them.

Thanks,


On Fri, Feb 3, 2012 at 6:16 PM, John McKee <jmmckee@xxxxxxxxxxxxxx> wrote:

The example I sent to you also included an environment variable that
causes *ESCAPE messages to be sent.  I can't remember if what I sent
also included code to return the return code from the sftp command
running in PASE.  If you don't have that piec of code, I will post
that.

Is the program running under the same user profile when it is running in
batch?

John McKee

On Fri, Feb 3, 2012 at 4:51 PM, Jeff Young <jyoung0950@xxxxxxxxx> wrote:
John,
I am not sure what they are for, but in all the examples that I have
seen,
the && is used.
Regardliess, the program functions properly when run Interactive and does
not send any data when Batch with no changes at all.
There is always some data to be sent.

I am looking for some explanation as to why that might be happening and
how
I can find out what is happening.

Thanks,

On Fri, Feb 3, 2012 at 5:32 PM, John McKee <jmmckee@xxxxxxxxxxxxxx>
wrote:

I am puzzled by the syntax on the CHGVAR used to build the &CMD
variable.  Specifically /BIN && sftp.

You might want to do a DMPCLPGM and check the variables to see if they
are formatted as you need.

John McKee

On Fri, Feb 3, 2012 at 3:00 PM, Jeff Young <jyoung0950@xxxxxxxxx>
wrote:
All,
I have finally gotten SFTP to work and was able to create a program to
transmitt data to the vendor.
When I run the program Interactivly, it works just fine.  I get my
sftplog.txt file that i specified in my environment variable with no
problems.
However, when I run it in the batch with the same user id, the data is
not
sent, and the sftplog.txt file is not created.
How can I findout what is happening differently when I run it in
batch vs
interactive?


            RTVDTAARA  DTAARA(IOMMSFTPIP) RTNVAR(&FTP_IP)

            ADDENVVAR  ENVVAR(SFTP_HOST) VALUE(&FTP_IP) +
                       REPLACE(*YES)

            ADDENVVAR  ENVVAR(QIBM_QSH_CMD_OUTPUT) +
                       VALUE('FILEAPPEND=/tmp/sftplog.txt') +
                       REPLACE(*YES)
            ADDENVVAR  ENVVAR(QIBM_QSH_CMD_ESCAPE_MSG) VALUE('Y') +
                       REPLACE(*YES)


               ADDENVVAR  ENVVAR(SFTP_USER) VALUE(&MMSFTPUSR)
+

REPLACE(*YES)


               CHGVAR     VAR(&CMD) VALUE('PATH=$PATH:/QOPENSYS/BIN&&
sftp
-b +
                          /FACEYMMS/MMS_SCRIPT.FTPS -oPort=2222
+
                          $SFTP_USER@$SFTP_HOST')



               QSH
CMD(&CMD)


-
               CPYFRMSTMF FROMSTMF('/tmp/sftplog.txt')     +
                          TOMBR('/QSYS.LIB/' || &LIB || +
                          '.LIB/SFTPLOG.FILE/' || &MEMBER |< '.MBR') +
                          MBROPT(*ADD)

When I run in batch, this command fails with an object not found
message.

All help will be appreciated.

Thanks,


Jeff Young
Sr. Programmer Analyst
--
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.

--
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.




--
Jeff Young
Sr. Programmer Analyst
--
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.

--
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.




--
Jeff Young
Sr. Programmer Analyst
--
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.


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.