Flat Files recognizing Numeric vs Char fields

I am creating an ASCII file, which will be transmitted to an external source via FTP.  In the file, if field lengths are shorter then what the file layout requires, then I need to pad either with trailing spaces or leading zeros depending on the data type.

My question is this, when I have a numeric field, the leading zeros are removed, and in many cases I need them to exist.  So, if I use a string field and force a right justify by padding leading zeros, will there be anyway to tell when the data is extracted by the external source that it was not a numeric field?  
Able22Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aflat362Commented:
No
0
Able22Author Commented:
So this method will work?
0
leonstrykerCommented:
It really depends on that is used to extract the data.  Some applications make the assessment as they import, others can use a format file, while still others make a guess based on the data in the field.  Do you know what the files are going to be used for and how?

Leon
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Richie_SimonettiIT OperationsCommented:
"My question is this, when I have a numeric field, the leading zeros are removed, and in many cases I need them to exist..."
But if you need them to exist, it is not a numeric field....
0
Able22Author Commented:
I understand your point Richie_Simonetti, however, here is an example:  The ASCII file layout that is required by the external vendor has a NUMERIC field, Cust_ID.  CUST_ID has a required length of 10.   However, my company's Cust_ID field is only a length of 6.  It is specified in the specs that if my field lengths don't match the ones in the given file layout, then I have to pad accordingly.  Therefore, I'd have to add 4 extra zeros to the beginning of my CUST_ID value to make it equal a length of 110.   So, I was wondering if I changed the CUST_ID to a string and added the zeros and printed it to the file, when the extract the data, will I cause a data-type mismatch.............
0
Able22Author Commented:
oops,  in the above comment, 10, not 110....
0
leonstrykerCommented:
The answer is: "Not likely, but posible".  Most software pakages or application will convert it to numeric using some form of "type casting".

Leon
0
SRigneyCommented:
The external application gets everything as a string.
By you meeting their format they probably already have an application set up to parse the field correctly and put it into their database.

They don't know or care if you store your data as a string or a number, as long as it's in the file in the format that they want.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richie_SimonettiIT OperationsCommented:
Could you replace those leading 0 by spaces?
I am asking you this 'cause i do a regular job on this kind of things (convert excel files to fixed length ascci files for SAP).
0
Dang123Commented:
Try writing your numbers using the format command

     Format(intCustID, "0000000000")


This will allow you to output your numbers with zero padding easily. The data will be pulled into the reading program as it expects it. I also work with COBOL, and there a field that contains any non-numeric characters (except for one period) is considered a character string. this method would definitely work to pass a number. The only way to be sure though is to send a test file to the program that needs to read your file.
0
aflat362Commented:
In a test enviornment - print it numerically, print it as a string.  Compare the 2 output files.  If you can tell no difference - the application which reads it can't either.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.