ftp truncating records

Posted on 2012-08-13
Last Modified: 2012-08-13

I have a vba application that is sending an ascii file via ftp to a server. There is a header, records and a footer in the file. Each record consists of a certain amount of text and ends with 1600 blank spaces. The ftp sends the file but truncates from the first blank space of the 1600 space section in the first record in the file right through to the footer but INCLUDES the footer.

I am sending using the following where nChars = 6047 (each record is 6046 chars long)

SendCommand("site lrecl=nChars recfm=fb cy pri=1000 sec=150")

So instead of, for example: (stuff in curly brackets is information - not actual data)

test header
test record1 {space}{space}{space}{space}{space} {etc...}
test record2 {space}{space}{space}{space}{space} {etc...}
test record3 {space}{space}{space}{space}{space} {etc...}
test footer

The ftp transfer is sending this:

test header
test record1 {no space}
{all other records truncated}
test footer

Can anyone help me send this file without truncating all that data?
Question by:boukaka
    LVL 56

    Expert Comment

    by:Jim Dettman (Microsoft MVP/ EE MVE)
    What client are you using to send the data?  Have you tried another client?  If another client does the same thing, then I would suspect something within the structure of your file.

    I would also check the transmission method; ASCII or binary.  You should be using ASCII.

    And as a side issue why all the blanks spaces?


    Author Comment

    Have tried using multiple clients - same issue

    I am sending using  vba code. We don't think it's the structure its just a basic text file - no special characters etc and if I send it using wraprecord, the whole file goes across (but of course with a line feed every 256 chars which is no good).

    Have to send the blank spaces because the file format IBM is insisting on includes those blank spaces. They aren't about to change their ingestion program to accommodate little old me :(

    I tried SendCommand("site trim=0 lrecl=nChars recfm=fb cy pri=1000 sec=150") but that didn't work either...
    LVL 82

    Accepted Solution

    Send it as 'binary' so that text mangling for line endings does not occur.

    Author Comment

    As a test, I just tried sending the file with no trailing spaces and it still says that it was truncated. I am attaching a sample of the file with spaces and without.

    Author Comment

    Binary seems to have worked!!! I will confirm and then award points.

    Author Closing Comment

    That worked - the file is not humanly readable but we can work with it. Thank you.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
    A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now