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

Re: FTP_list max entries 80 or list sequence issue



Kevin,

It's not clear to me how your code works, exactly. But, the fact that you're using a BASED() variable makes me very nervous. The system does not assign memory to based variables, so you have to allocate it yourself or point it at some other variable that does have memory assigned to it. Personally, I would prefer just defining an array and passing it and skipping all the extraneous pointer logic.

For example, something like this:

D myList          s            256a   dim(10000)
D myCount         s             10i 0

  if FTP_list( ftp
             : '*.pdf'
             : %elem(myArray)
             : %addr(myArray)
             : myCount ) <  0;
    ... handle error here ...
  endif;

  for x = 1 to myCount;
     // do something with myArray(x)
  endfor;

So this example gets a list of files matching '*.pdf' in the current FTP server directory and returns them in an array named myArray(). myCount will tell you how many files were loaded into the array.

Personally, I think it's a lot cleaner this way than that business with the 'ListBase' and the constant of 80 and stuff like that. I think it' much easier to understand when you aren't doing the extra pointer logic and I think it's much easier to understand %elem() is telling FTPAPI how big your array is.




On 2/10/2016 1:31 PM, Kevin Gilder wrote:
    Hi Scott,

    This was based on an example with a description that 80 was the max. So
    our code is like this

    D cMaxEnt         c                   80

    D pMaxEnt         s             10i 0   inz(cMaxEnt)
    D pLSArry         s               *
    D pActEnt         s             10i 0   inz(0)

    D ListBase        s          25600a     based(pLSArry)
    D ListData        s            256a     dim(cMaxEnt)

      If        ftp_List(ftp
                       : pRmtFil
                       : pMaxEnt
                       : pLSArry
                       : pActEnt
                       ) < 0

    So instead we could increase ListBase to 256000, and set CMaxEnt to
    2560.

    We then sort the array to ensure we then process the files in the
    correct order.

    I presume the max we could handle would be 16million/256 to file an
    array with file names? Not that I expect or hope to ever reach that
    number.

    Many thanks for your help.

    From: Scott Klement <sk@xxxxxxxxxxxxxxxx>
    To: HTTPAPI and FTPAPI Projects <ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
    Sent: 10/02/2016 7:01 PM
    Subject: Re: FTP_list max entries 80 or list sequence issue

      Hi Kevin,
      I'm not aware of this limit.  Can you tell me where you are seeing a
      limit of 80 entries in FTP_list()?
      I thought you could tell it your array size on the call to
      FTP_list()
      and could specify any size array that you wanted?
      -SK
      On 2/10/2016 11:14 AM, Kevin Gilder wrote:
      >     Hi,
      >
      >     We are using the FTPAPI but have a question about the maximum
      number of
      >     entries in the list function.
      >
      >     This is set at 80 but we have a scenario where there could be
      several
      >     hundred files to be processed.
      >
      >     This problem is that they have to processed in the correct
      sequence.
      >
      >     How can we retrieve more entries in the list OR how can we
      control that
      >     the entries retrieved are alphabetically sequence (oldest 80
      at a
      >     time). The actual filenames start with a timestamp but are not
      being
      >     listed in that order.
      >
      >     Is it as simple as changing the Maxent constant to, say, 500.
      >
      >     Many thanks
      >
      __________________________________________________________________
      >
      >     Enterprise Software Systems.
      >     Company No 3374336. Registered in England,
      >     Registered Office: Enterprise House, Pacific Road
      >     Altrincham, Cheshire, WA14 5EN
      >     The information in this email is confidential and may be
      legally
      >     privileged. It is intended solely for the addressee. Access to
      this ema
      >     il
      >     by anyone else is unauthorized. If you are not the intended
      recipient,
      >     any
      >     disclosure, copying, distribution or any action taken or
      omitted to be
      >     taken in reliance on it, is prohibited and may be unlawful. If
      you are
      >     not
      >     the intended addressee please contact the sender and dispose
      of this
      >     e-mail.
      >
      >
      >
      >
      --------------------------------------------------------------------
      ---
      > This is the FTPAPI mailing list.  To unsubscribe, please go to:
      > http://www.scottklement.com/mailman/listinfo/ftpapi
      >
      --------------------------------------------------------------------
      ---
      --------------------------------------------------------------------
      ---
      This is the FTPAPI mailing list.  To unsubscribe, please go to:
      http://www.scottklement.com/mailman/listinfo/ftpapi
      --------------------------------------------------------------------
      ---
      __________________________________________________________________

    Enterprise Software Systems.
    Company No 3374336. Registered in England,
    Registered Office: Enterprise House, Pacific Road
    Altrincham, Cheshire, WA14 5EN
    The information in this email is confidential and may be legally
    privileged. It is intended solely for the addressee. Access to this ema
    il
    by anyone else is unauthorized. If you are not the intended recipient,
    any
    disclosure, copying, distribution or any action taken or omitted to be
    taken in reliance on it, is prohibited and may be unlawful. If you are
    not
    the intended addressee please contact the sender and dispose of this
    e-mail.



-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------