Subject: | |
From: | |
Reply To: | |
Date: | Mon, 15 May 2000 15:04:42 +0100 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
We had the same problem - basically you have to check a each variable in turn - here's a
Cobol code fragment from a subroutine written by my colleague Mike Williams. The first simply
gets the CIERROR variable.
MOVE 0 TO FTPP-VALUE-1.
*
CALL INTRINSIC "HPCIGETVAR" USING FTPP-VARNAME,
FTPP-STATUS,
FTPP-ITEM-1,
FTPP-VALUE-X.
*
IF FTPP-STATUS <> 0
MOVE 0002 TO FTPA-ERROR-NUM
MOVE FTPP-VARNAME TO FTPA-0002-VARNAME
MOVE FTPA-ERROR-0002 TO FTPA-ERROR-MSG
GO TO FTPP-EXIT.
*
IF FTPP-VALUE-1 <> 0
MOVE "Run FTP command failed"
TO FTPA-ERROR-MSG
MOVE FTPP-VALUE-1 TO FTPA-ERROR-NUM
GO TO FTPP-EXIT.
*
MOVE 0 TO FTPP-STATUS
MOVE SPACES TO FTPP-VALUE-X
MOVE 2 TO FTPP-ITEM-1
MOVE "FTPLASTREPLY" TO FTPP-VARNAME
CALL INTRINSIC "HPCIGETVAR" USING FTPP-VARNAME,
FTPP-STATUS,
FTPP-ITEM-1,
FTPP-VALUE-X
IF FTPP-STATUS <> 0
MOVE 0002 TO FTPA-ERROR-NUM
MOVE FTPP-VARNAME TO FTPA-0002-VARNAME
MOVE FTPA-ERROR-0002 TO FTPA-ERROR-MSG
GO TO FTPP-EXIT.
*
MOVE FTPP-VALUE-X TO FTPP-LAST-REPLY.
*
MOVE 0 TO FTPP-VALUE-1.
MOVE 0 TO FTPP-STATUS.
MOVE 1 TO FTPP-ITEM-1.
MOVE "FTPLASTERR" TO FTPP-VARNAME.
*
CALL INTRINSIC "HPCIGETVAR" USING FTPP-VARNAME,
FTPP-STATUS,
FTPP-ITEM-1,
FTPP-VALUE-1.
*
IF FTPP-STATUS <> 0
MOVE 0002 TO FTPA-ERROR-NUM
MOVE FTPP-VARNAME TO FTPA-0002-VARNAME
MOVE FTPA-ERROR-0002 TO FTPA-ERROR-MSG
GO TO FTPP-EXIT.
*
MOVE FTPP-VALUE-1 TO FTPP-LAST-ERR.
* DISPLAY "FTPP-LAST-ERR: ",FTPP-LAST-ERR.
* DISPLAY "FTPP-LAST-REPLY: ",FTPP-LAST-REPLY.
*
* NB. If the LAST-REPLY does not start with 221, then FTP did
* not exit correctly
*
IF FTPP-LAST-ERR <> ZERO
OR FTPP-LAST-REPLY(1:3) <> "221"
MOVE FTPP-LAST-ERR TO FTPA-ERROR-NUM
MOVE SPACES TO FTPP-VALUE-X
MOVE "FTPLASTMSG" TO FTPP-VARNAME
MOVE 2 TO FTPP-ITEM-1
CALL INTRINSIC "HPCIGETVAR" USING FTPP-VARNAME,
FTPP-STATUS,
FTPP-ITEM-1,
FTPP-VALUE-X
IF FTPP-VALUE-X = SPACES
OR FTPP-LAST-REPLY(1:3) = "550"
MOVE FTPP-LAST-REPLY TO FTPA-ERROR-MSG
IF FTPA-ERROR-NUM = ZERO
MOVE 550 TO FTPA-ERROR-NUM
END-IF
ELSE
MOVE FTPP-VALUE-X TO FTPA-ERROR-MSG
END-IF
GO TO FTPP-EXIT
END-IF.
>>> George Willis <[log in to unmask]> 15/05/00 14:47:54 >>>
I'm looking for suggestions on why FTP does not set an error condition when
it encounters a "SOCKERR". How can we catch this and not allow the job to
continue?
PUT AMODSUB.DBASE.DVTEMP AmodSub.Dat
200 PORT command successful.
150 Opening BINARY mode data connection for AmodSub.Dat.
425 Can't open data connection.
Error 0 (SOCKERR)
END OF PROGRAM
:IF FTPLASTERR <> 0
*** EXPRESSION FALSE: COMMANDS IGNORED UNTIL MATCHING ELSEIF/ELSE
/ENDIF
: TELLOP ** FTP Contains a problem
: SETAPAGE
: SETVAR ADDR "!GJWP," + "!WFKP," + "!HDDP"
: MAILER "!ADDR" "[FS1] WHFTP Contains errors."
: FLUSHME
:ENDIF
Here are the environment variables at the time of this event:
FTPLASTERR = 0
FTPXFERFILES = 1
FTPREQFILES = 1
FTPREPLACE = TRUE
FTPLASTREPLY = 425 Can't open data connection.
FTPLASTMSG = Error 0 (SOCKERR)
George Willis
Fayez Sarofim & Co
713-308-2803
|
|
|