The FTPOSTPR user exit

FTPOSTPR is called upon completion of the FTP commands RETR, STOR, STOU, APPE, DELE, and RNTO. The user exit is passed as follows:
  • The user ID
  • The client IP address
  • The client port number
  • The current directory type
  • The length of the parameter string
  • The current working directory
  • The current file type
  • The FTP reply code
  • A buffer containing the FTP reply line sent to the client
  • The FTP command code
  • The current CONDDISP setting
  • The file transfer completion code
  • Name of the data set or z/OS® UNIX file retrieved or stored
  • Two words containing the bytes transferred during execution of this command
  • The socket address structure of the client's control connection
  • The socket address structure of the server's control connection
  • A buffer containing the session instance identifier
  • A 256-byte scratchpad buffer
  • The one-byte description of the confidence level in successful completion of a transfer
  • A buffer containing the FTP reply
The user exit can take action based on any of the information passed to it. The close reason code indicates whether the command completed successfully. The scratchpad buffer can be used to communicate information to other exits or the next instance of this exit.
The following parameter list is passed to FTPOSTPR:
Offset
Value
+0
Pointer to the fullword return code. The value is always 0 and is passed only for consistency with other FTP user exits and parameter lists.
+4
Pointer to a word containing the number of following parameters (17).
+8
Pointer to the 8-byte buffer containing the user ID.
+12
Pointer to the 4-byte client IP address. If the client's address is an IPv6 address, this field points to a word containing x'FFFFFFFF' and the passed socket address structure for the client must be used instead. If the client's address is an IPv4 address, either this field or the socket address structure can be used.
+16
Pointer to the 2-byte client port number. Valid only when the 4-byte client IP address is not x'FFFFFFFF'.
+20
Pointer to the 4-byte character string with current directory type: MVS™ or z/OS UNIX (left-aligned).
+24
Pointer to a buffer containing the current directory value. The first 2 bytes hold the length of the remaining buffer.
+28
Pointer to the 4-character byte field containing the current file type (SEQ, JES, SQL) left-aligned.
+32
Pointer to the 3-character byte field containing the current FTP reply code.
+36
Pointer to buffer containing the last line of the FTP reply. The first 2 bytes contain the length of the remaining buffer.
+40
Pointer to the 4-byte field containing the current FTP command code.
+44
Pointer to the 1-character byte field containing the current CONDDISP setting: C for catalog, D for delete.
+48
Pointer to the 4-byte binary field with close reason code:
  • 0 — Transfer completed normally.
  • 4 — Transfer completed with errors; see FTP reply code and text string.
  • 8 — Transfer completed with socket communication errors; transfer is ended and no response can be sent to client.
  • 12 — Transfer aborted after data connection was established.
  • 16 — Transfer aborted with SQL file errors after data connection was established.
+52
Pointer to a buffer containing the name of the data set or z/OS UNIX file just retrieved or stored. The first two bytes hold the length of the remainder, and the remainder of the buffer (up to 1023 bytes) holds any additional path specification beyond the current working directory and the file name.
+56
Pointer to two contiguous words containing the bytes transferred during execution of the current FTP command. The first word holds the number of gigabytes transferred. The second word holds the number of bytes transferred in addition to the number of gigabytes transferred. The number of bytes value (word 2) can be up to 4 gigabytes.
+60
Pointer to a copy of the socket address structure for the client's control connection. This area is mapped by the SOCKADDR DSECT found in the sample exit. The FAMILY field denotes whether the structure contains an IPv4 or an IPv6 address. When the family is AF_INET, the structure contains an IPv4 address. When the FAMILY is AF_INET6, you must inspect the address itself to determine whether it is an IPv6 address or an IPv4 mapped IPv6 address.
+64
Pointer to a copy of the socket address structure for the server's control connection. This area is mapped by the SOCKADDR DSECT found in the sample exit. The FAMILY field denotes whether the structure contains an IPv4 or an IPv6 address. When the family is AF_INET, the structure contains an IPv4 address. When the FAMILY is AF_INET6, you must inspect the address itself to determine whether it is an IPv6 address or an IPv4 mapped IPv6 address.
+68
Pointer to a buffer containing a 2-byte length followed by the session identifier created by the daemon when the connection was first established for this session. The identifier has a maximum length of 14 bytes and is unique within this instance of the server.
+72
Pointer to a 256-byte scratchpad buffer, which can be used to pass information between user exits. All exits receive a pointer to this buffer except FTCHKIP and FTCHKPWD. FTP does not query or alter the contents of the scratchpad at any time. The extended tracing (DUMP) identifier of the scratchpad is 87. If extended tracing of the scratchpad is requested, the contents are dumped after execution of the user exit.
+76
Pointer to a 1-byte description of the confidence level in successful completion of a transfer. Possible values are:
X'00'
Confidence level is High. No errors were detected on the inbound transfer
X'01'
Confidence level is NoEOF due to a missing EOF marker in an inbound file being transferred using STRUCTURE RECORD, MODE B, or MODE C.
X'02'
Confidence level is Low because the client did not respond after the inbound transfer or another error was reported. Low overrides NoEOF if both conditions are present.
X'03'
Confidence level is Unknown because this is an outbound transfer. An outbound transfer reports a confidence level of Low if an error occurs shutting down the data connection. Otherwise, outbound transfers are reported as Unknown even if no error was detected because not all checks can be done for outbound transfers
X'04'
Confidence level checking is not active. See CHKCONFIDENCE statement (FTP client and server) statement.
+80
Pointer to a buffer containing the complete text of the server reply that was sent to the client. The first two bytes contain the length of the remaining buffer.

When the length of the remaining buffer is 0, FTP could not obtain sufficient storage to hold the complete text of the server reply. You can obtain the last line of the reply by inspecting the parameter at offset x'36'.