Return to the FTP Tips
This is the skeleton of what we do before any FTP
by Scott Lindstrom; Zenith Electronics
DCL VAR(&SUCCESSBIN) TYPE(*CHAR) LEN(4) DCL VAR(&SUCCESSDEC) TYPE(*DEC) LEN(15) PING RMTSYS(&RMTSYS) INTNETADR(&IP) NBRPKT(10) /* + Check if the remote system responds */ MONMSG MSGID(TCP3202) EXEC(DO) /* Unknown Host */ (send some error message) GOTO (some label) ENDDO RCVMSG MSGTYPE(*COMP) RMV(*NO) MSGDTA(&MSGDTA12) + MSGID(&MSGID) /* Get the last completion + message; it should be TCP3210 which gives + the success percentage */ IF COND(&MSGID *NE 'TCP3210') THEN(DO) /* If + not what we expected */ GOTO CMDLBL(STRFTP) /* Try the FTP anyways */ ENDDO CHGVAR VAR(&SUCCESSBIN) VALUE(%SST(&MSGDTA12 9 4)) + /* Extract out the success percentage */ CVTBIN4DEC BINARY(&SUCCESSBIN) DECIMAL(&SUCCESSDEC) /* + and convert to decimal so we can check it + easiliy */ IF COND(&SUCCESSDEC *GE 10) THEN(DO) /* If at + least 10% of the pings worked */ GOTO CMDLBL(STRFTP) /* Do the FTP */ ENDDO ELSE CMD(DO) (send some error message) ENDDO
[report a broken link by clicking here]