[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Works in test but not production



I am writing a program to pull files updated daily from a Windows FTP server, into an IFS location. They are ASCII .CSV files. We have separate test and production LPARs. I can run the program in the test LPAR and have it receive data, but it does not work in the production LPAR.

 

Are there any settings on the AS/400 that could account for the difference? Any help is appreciated!

 

 

 

 

Program call:

call idgrecve1 parm('/tmp/idgincoming/20050406/                        ') /* Char 50 */

 

 

Here is the program, similar to the provided TESTMGET:

h bnddir('LIBFTP/FTPAPI') dftactgrp(*no) actgrp(*new)

 

d inpath          s             50a

 

 /copy libftp/ftpapisrc,ftpapi_h

 

D CompMsg         pr

D   peMsgTxt                   256A   Const

 

d SERVER          c                   'ip'

d USER            c                   'user'

d PASSWORD        c                   'pass'

d TIMEOUT         c                   60

d NUMFILESTOGET   c                   50

 

d errnum          s             10i 0 inz

d fd              s             10i 0 inz

d fileno          s             10i 0 inz

d gotfiles        s             10i 0 inz

d incoming        s            256a   inz dim(NUMFILESTOGET)

d incomingdir     s             50a   inz varying

d num_files       s             10i 0 inz

d rc              s             10i 0 inz

d retrievefile    s            256a   inz

 

 // Lists.

c     *entry        plist

c                   parm                    inpath

 

 /free

 

    // Initialization.

    incomingdir = %trim(inpath);

 

    // Enable joblog logging.

    ftp_logging( 0 : *on );

 

    // Connect to FTP server.

    fd = ftp_conn( SERVER : USER : PASSWORD : FTP_PORT : TIMEOUT );

    if fd < 0;

         compmsg( FTP_errorMsg(0) );

         exsr exit;

    endif;

 

    // Change transfer format to ASCII.

    ftp_binarymode( fd : *off );

 

    // Retrieve file list for multiple get. The files are in the default

    // directory.

    rc = ftp_list( fd : '*.csv' : NUMFILESTOGET : %addr(incoming) :

         num_files );

    if rc < 0;

         ftp_errorMsg( fd : ErrNum );

         if ErrNum = FTP_NOFILE;

              num_files = 0;

         else;

              CompMsg( FTP_errorMsg( fd ) );

              ftp_quit( fd );

              exsr exit;

         endif;

    endif;

 

    // Download everything to the IDG incoming directory.

    gotfiles = 0;

    for fileno = 1 to num_files;

         retrievefile = incomingdir + %trim(incoming(fileno));

         rc = ftp_get( fd : incoming(fileno) : %trim(retrievefile));

         if rc >= 0;

              gotfiles += 1;

         else;

              ftp_errorMsg( fd : ErrNum );

              compmsg(ftp_errorMsg( fd : ErrNum ));

         endif;

    endfor;

 

    // Close FTP session.

    ftp_quit( fd );

 

    // Send completion messages.

    if gotfiles > 0;

         if gotfiles = num_files;

              CompMsg( 'All files received!' );

         else;

              CompMsg( 'Some files were not received. Please review.' );

         endif;

    else;

         CompMsg( 'No files received. Please review.');

    endif;

 

    exsr exit;

 

    // --------------------------------------------------------------------

 

    begsr exit;

 

         *inlr = *on;

         return;

 

    endsr;

 

 /end-free

 

 // -----------------------------------------------------------------------

 

p CompMsg         b

D CompMsg         PI

D   peMsgTxt                   256A   Const

 

D dsEC            DS

 *                                    Bytes Provided (size of struct)

D  dsECBytesP             1      4B 0 INZ(256)

 *                                    Bytes Available (returned by API)

D  dsECBytesA             5      8B 0 INZ(0)

 *                                    Msg ID of Error Msg Returned

D  dsECMsgID              9     15

 *                                    Reserved

D  dsECReserv            16     16

 *                                    Msg Data of Error Msg Returned

D  dsECMsgDta            17    256

 

D SndPgmMsg       PR                  ExtPgm('QMHSNDPM')

D   MessageID                    7A   Const

D   QualMsgF                    20A   Const

D   MsgData                    256A   Const

D   MsgDtaLen                   10I 0 Const

D   MsgType                     10A   Const

D   CallStkEnt                  10A   Const

D   CallStkCnt                  10I 0 Const

D   MessageKey                   4A

D   ErrorCode                    1A

 

D wwMsgLen        S             10I 0

D wwTheKey        S              4A

 

c     ' '           checkr    peMsgTxt      wwMsgLen

c                   callp     SndPgmMsg('CPF9897': 'QCPFMSG   *LIBL':

c                               peMsgTxt: wwMsgLen: '*COMP':'*PGMBDY':

c                               1: wwTheKey: dsEC)

 

p CompMsg         e

 

 

 

 

Here is the file information on the server:

Connecting to host BWETSFTP at address 10.224.248.20 using port 21.

220 BWETSPUBLICWEB Microsoft FTP Service (Version 5.0).

idg

331 Password required for idg.

230-Welcome to the BorgWarner Emissions/Thermal Systems FTP site.

230 User idg logged in.

Windows_NT version 5.0

ls -l

227 Entering Passive Mode (10,224,248,20,9,224).

125 Data connection already open; Transfer starting.

04-06-05  06:30AM                 1241 IBWW_NSOpenOrders.csv

04-06-05  06:20AM                26412 IBWWFile.csv

226 Transfer complete.

 

 

 

Here is the output as logged from test:

0: FTPAPI version 2.0beta3 released on 2004-06-24

0: 220 BWETSPUBLICWEB Microsoft FTP Service (Version 5.0).

0: > USER idg

0: 331 Password required for idg.

0: > PASS **********

0: 230-Welcome to the BorgWarner Emissions/Thermal Systems FTP site.

0: 230 User idg logged in.

0: > TYPE A

0: 200 Type set to A.

0: > PORT 10,121,17,58,25,169

0: 200 PORT command successful.

0: > NLST *.csv

0: 150 Opening ASCII mode data connection for file list.

0: 226 Transfer complete.

0: > TYPE A

0: 200 Type set to A.

0: > SIZE IBWW_NSOpenOrders.csv

0: 213 1241

0: > TYPE A

0: 200 Type set to A.

0: > PORT 10,121,17,58,25,170

0: 200 PORT command successful.

0: > RETR IBWW_NSOpenOrders.csv

0: 150 Opening ASCII mode data connection for IBWW_NSOpenOrders.csv(1241

  bytes).

0: 226 Transfer complete.

0: > TYPE A

0: 200 Type set to A.

0: > SIZE IBWWFile.csv

0: 213 26412

0: > TYPE A

0: 200 Type set to A.

0: > PORT 10,121,17,58,25,171

0: 200 PORT command successful.

0: > RETR IBWWFile.csv

0: 150 Opening ASCII mode data connection for IBWWFile.csv(26412 bytes).

0: 226 Transfer complete.

0: > QUIT

0: 221  Have a nice day!

All files received!

 

 

 

…and the output as logged from production:

0: FTPAPI version 2.0beta3 released on 2004-06-24

0: 220 BWETSPUBLICWEB Microsoft FTP Service (Version 5.0).

0: > USER idg

0: 331 Password required for idg.

0: > PASS **********

0: 230-Welcome to the BorgWarner Emissions/Thermal Systems FTP site.

0: 230 User idg logged in.

0: > TYPE A

0: 200 Type set to A.

0: > PORT 10,121,17,7,103,65

0: 200 PORT command successful.

0: > NLST *.csv

0: 150 Opening ASCII mode data connection for file list.

0: 226 Transfer complete.

0: > TYPE A

0: 200 Type set to A.

0: > SIZE IBWW_NSOpenOrders.csv

0: 213 1241

No such path or directory.

0: > TYPE A

0: 200 Type set to A.

0: > SIZE IBWWFile.csv

0: 213 26412

No such path or directory.

0: > QUIT

0: 221  Have a nice day!

No files received. Please review.

 

 

 

 

Loyd Goodbar

Senior programmer/analyst

BorgWarner

E/TS Water Valley

662-473-5713