****************************************
      * Program name: ftp.cbl
      * This program provides several examples
      * of FTP statement usage.
      *
      * Copyright 2000 Deskware, Inc.
      ****************************************                                                             
      * Syntax: FTPCONNECT USING   .        
      *                                                               
      * Syntax: FTPCD USING .                              
      *                                                               
      * Syntax: FTPGET USING .                              
      *                                                               
      * Syntax: FTPPUT USING .                              
      *                                                               
      * Syntax: FTPASCII.                                             
      *                                                               
      * Syntax: FTPBINARY.                                            
      *                                                               
      * Include the TCP/IP variable copybook.
       COPY `tcpip.cpy`.
      
      * Variables
       1 host_name        PIC X(255).
       1 user             PIC X(30).
       1 password         PIC X(30).

       MAIN.
      * Substitute your host name for the host name below
            MOVE `yourhostname.com` TO host_name.
            MOVE `youruserid`       TO user.
            MOVE `yourpassword`     TO password.
            IF host_name(1:16) = `yourhostname.com`
               DISPLAY `Edit this program's host_name variable to run it.`
            ELSE
               PERFORM PROCESS-FTP-STATEMENTS
            END-IF.
            GOBACK.

       PROCESS-FTP-STATEMENTS.
            FTPCONNECT USING host_name user password.
            DISPLAY `FTPCONNECT TCPIP-RETURN-CODES: ` & TCPIP-RETURN-CODES.
            
            FTPBINARY.
            DISPLAY `FTPASCII TCPIP-RETURN-CODES: `  & TCPIP-RETURN-CODES.
            
            FTPCD USING `yourdirectory`.
            DISPLAY `FTPCD TCPIP-RETURN-CODES: `  & TCPIP-RETURN-CODES.
            
            FTPGET USING `yourfilename`.           
            DISPLAY `FTPGET TCPIP-RETURN-CODES: `  & TCPIP-RETURN-CODES.
      
      *      FTPCD USING `\pub\incoming`.
      *      DISPLAY `FTPCD TCPIP-RETURN-CODES: `  & TCPIP-RETURN-CODES.
      * replace `myfile.txt` with a valid file if you have one to test
      *      FTPPUT USING `myfile.txt`.
      *      DISPLAY `FTPPUT TCPIP-RETURN-CODES: `  & TCPIP-RETURN-CODES.

            FTPCLOSE.
            DISPLAY `FTPCLOSE TCPIP-RETURN-CODES: `  & TCPIP-RETURN-CODES.