PGM PARM(&HOST)
/*********************************************************************/
/* Declare program variables */
/*********************************************************************/
DCL &HOST *CHAR LEN(50)
DCL &DEVICE *CHAR LEN(10)
DCL &USER *CHAR LEN(10)
DCL &NBR *CHAR LEN(6)
DCL &TYPE *CHAR LEN(1)
DCL &SENDER *CHAR LEN(80)
DCL &PROGRAM *CHAR LEN(10)
/*********************************************************************/
/* Declare standard error handling variables */
/*********************************************************************/
DCL &ERRORSW *LGL /* Standard error */
DCL &MSGID *CHAR LEN(7) /* Standard error */
DCL &MSG *CHAR LEN(512) /* Standard error */
DCL &MSGDTA *CHAR LEN(512) /* Standard error */
DCL &MSGLEN *DEC LEN(5 0) /* Standard error */
DCL &MSGF *CHAR LEN(10) /* Standard error */
DCL &MSGFLIB *CHAR LEN(10) /* Standard error */
DCL &KEYVAR *CHAR LEN(4) /* Standard error */
DCL &KEYVAR2 *CHAR LEN(4) /* Standard error */
DCL &RTNTYPE *CHAR LEN(2) /* Standard error */
DCL &MSGKEY *CHAR LEN(4) /* Key of message for SBMJOB */

/*********************************************************************/
/* Monitor for the global error to handle errors that are not */
/* specifically checked */
/*********************************************************************/
MONMSG MSGID(CPF0000) EXEC(GOTO STDERR1) /* Std err */
CHGVAR &MSGLEN VALUE(80) /* Std err */

RTVJOBA JOB(&DEVICE) USER(&USER) NBR(&NBR) TYPE(&TYPE)

/*********************************************************************/
/* If this program is called interactively submit it to batch */
/*********************************************************************/
IF (&TYPE = '1') THEN(DO)
SNDPGMMSG MSGID(CPF9898) MSGF(QCPFMSG) TOPGMQ(*SAME) +
KEYVAR(&MSGKEY)
RCVMSG MSGTYPE(*INFO) MSGKEY(&MSGKEY) WAIT(*MAX) +
SENDER(&SENDER)
CHGVAR VAR(&PROGRAM) VALUE(%SST(&SENDER 27 10))
SBMJOB CMD(CALL PGM(&PROGRAM) PARM(&HOST)) +
JOB(&PROGRAM) LOG(4 00 *SECLVL)
RCVMSG MSGTYPE(*COMP) MSGDTA(&MSGDTA) MSGID(&MSGID) +
MSGF(&MSGF) MSGFLIB(&MSGFLIB)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) TOPGMQ(*PRV) MSGTYPE(*COMP)
RETURN
ENDDO

/*********************************************************************/
/* Run the */
/*********************************************************************/

CLRPFM FILE(PARTITION/SOURCE) MBR(FTPOUT)
OVRDBF FILE(INPUT) TOFILE(PARTITION/SOURCE) MBR(FTPCMDS)
OVRDBF FILE(OUTPUT) TOFILE(PARTITION/SOURCE) MBR(FTPOUT)
FTP RMTSYS(&HOST)

END:
RETURN

/*********************************************************************/
/* Process the standard error handling routines */
/*********************************************************************/
STDERR1:
IF &ERRORSW SNDPGMMSG MSGID(CPF9999) +
MSGF(QCPFMSG) MSGTYPE(*ESCAPE)
CHGVAR &ERRORSW '1' /* Set to fail on error */
RCVMSG MSGTYPE(*EXCP) RMV(*NO) KEYVAR(&KEYVAR)
STDERR2: RCVMSG MSGTYPE(*PRV) MSGKEY(&KEYVAR) RMV(*NO) +
KEYVAR(&KEYVAR2) MSG(&MSG) +
MSGDTA(&MSGDTA) MSGID(&MSGID) +
RTNTYPE(&RTNTYPE) MSGF(&MSGF) +
SNDMSGFLIB(&MSGFLIB)
IF (&RTNTYPE *NE '02') GOTO STDERR3
IF (&MSGID *NE ' ') SNDPGMMSG +
MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*DIAG)
IF (&MSGID *EQ ' ') SNDPGMMSG +
MSG(&MSG) MSGTYPE(*DIAG)
RMVMSG MSGKEY(&KEYVAR2)
STDERR3: RCVMSG MSGKEY(&KEYVAR) MSGDTA(&MSGDTA) +
MSGID(&MSGID) MSGF(&MSGF) +
SNDMSGFLIB(&MSGFLIB)
SNDPGMMSG MSGID(&MSGID) MSGF(&MSGFLIB/&MSGF) +
MSGDTA(&MSGDTA) MSGTYPE(*ESCAPE)
ENDPGM

Here's the FTPCMDS portion of the script (set up to grab groups from IBM the
old way)

anonymous anystupidthing
namefmt 1
lcd /ibmi/v7r4/groups
binary
cd /ccss/B31684/groups/C
mget *.bin
quit

Here's a command to make the whole thing more easy:

CMD PROMPT('Start Batch FTP')
PARM KWD(ADDRESS) TYPE(*CHAR) LEN(50) +
DFT('delivery01-bld.dhe.ibm.com')


Error handling routine from Jim Slone, in a way back session. Has never
failed me.

--
Jim Oberholtzer
Agile Technology Architects

-----Original Message-----
From: MIDRANGE-L <midrange-l-bounces@xxxxxxxxxxxxxxxxxx> On Behalf Of
Timothy Feldmeier
Sent: Tuesday, June 15, 2021 10:48 AM
To: MIDRANGE-L@xxxxxxxxxxxxxxxxxx
Subject: FTP LPAR to LPAR

Does anyone have a good FTP script example that will execute seamlessly from
a FTP INPUT script. I need to send a Savefile from one Lpar to another Lpar.

Thank You

Tim Feldmeier
Programmer Analyst For Coyote System
Roadrunner Freight (LTL)
Office: 331.233.7921 Cell: 630.730.9793
timothy.feldmeier@xxxxxxxx<mailto:timothy.feldmeier@xxxxxxxx>
1431 Opus Place, Suite 530
Downers Grove, IL 60515
shiproadrunnerfreight.com<https://www.shiproadrunnerfreight.com/>

[LinkedIn_Icon]<https://www.linkedin.com/showcase/roadrunner-freight/>[Faceb
ook_Icon]<https://facebook.com/Roadrunnerfreight/> [Instagram_Icon]
<https://www.instagram.com/roadrunner_freight/> [YouTube_Icon]
<https://www.youtube.com/channel/UCaOqSJsKB9hc5-t3t3w2xpg>

The information transmitted is intended only for the person or entity to
which it is addressed and may contain proprietary, business-confidential
and/or privileged material. If you are not the intended recipient of this
message you are hereby notified that any use, review, retransmission,
dissemination, distribution, reproduction or any action taken in reliance
upon this message is prohibited. If you received this in error, please
contact the sender and delete the material from any computer.
--
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 at
https://archive.midrange.com/midrange-l.

Please contact support@xxxxxxxxxxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate link:
https://amazon.midrange.com


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.