Dec 062017
 
General text file converterand manipulator. Move columns, change delimiters, split files, etc.
File CASCII.ZIP from The Programmer’s Corner in
Category Word Processors
General text file converterand manipulator. Move columns, change delimiters, split files, etc.
File Name File Size Zip Size Zip Type
CVASCII.DOC 10269 2995 deflated
CVASCII.EXE 30303 13275 deflated

Download File CASCII.ZIP Here

Contents of the CVASCII.DOC file


CVASCII - Ascii file translation utility, Version 1.01, created 11/01/89
(C) COPYRIGHT 1989 by Precision Programming, Inc. Dallas, TX ALL RIGHTS RESERVED

Please send all inquiries to:
Glenn W Woods
Precision Programming, Inc.
5290 Beltline Road, Suite 152
Dallas, TX 75227
FAX 214-388-1422
CompuServe ID: 76166,11

You may copy and distribute this program freely, with the exceptions of:
1. No fee is charged for copying and distribution.
2. It is distributed ONLY in its original, unmodified state.

If you like this program, and find it useful, then your contribution will be
appreciated. You may not use this product in a commercial or a government
organization without paying a license fee of $25. Site licenses and commercial
distribution licenses are available. A program disk and printed documentation
are available for $40. ANSI standard 'C' source available for porting to other
environments.

If you fail to abide by the terms of this license, may the hound dogs of a
thousand red necks bark outside of you bedroom window. ",

The need for CVASCII came about through my company for converting other
software data into our data format. I found that I was writing a new program
everytime that I had to translate new data. Finally after a year or so of
doing this I realized that if I could place the new data into a ascii file
whose format was constant then I would not have to rewrite my program again.
Therefore, the purpose for CVASCII is to be able to translate one or more
ascii files in either delimited or fixed field format into one or more ascii
files. In this translation process fields can be reordered, resized,
constants added, padded with special characters and change delimitors. The
program will process as many records as found in the first old ascii file.
Therefore, if you have three input files and the first file has more records
than the other two, the remaining records will have NULL fields that correspond
the the last two files.

Usage: CVASCII description file

Flags: O - Old ascii file indicator (input file names)
N - New ascii file indicator (output file names)
# - Field or optional file number indicator (default is 1)
D=[] - Delimited file indicator (the default file type), also the
delimitor definer, upto 4 characters (default \" commas implied)
P - Fixed file indicator, cannot be used with a delimited file
B=[] - Padding for fields (default ' ' character 32)
F - Field indicator
C=[] - Constant to be placed in a record (use \n for character 10)
J=[] - Justification of fixed data, L-Left or R-Right (default left)

Syntax: O{#} = filename{,D{=[]}}{,P}{,B=[]}
N{#} = filename{,D{=[]}}{,P}{,B=[]}
F{#}{,O{#}} = F{#},maxlen{,N{#}}
= P,begin,length{,N{#}}{,J=[]}
P,begin,length{,O{#}}{,J=[]} = F{#},maxlen{,N{#}}
= P,begin,length{,N{#}}{,J=[]}
C=[constant] = F{#},maxlen{,N{#}}
= P,begin,length{,N{#}}{,J=[]}

Limits: 10 input files 100 fields per file with up to 1000 bytes per field
10 output files 5000 byte maximum record length per file

In the above syntax anything that is in {} is optional with defaults being
used if nothing is declared. Even though the syntax seems some what cumbersome,
it just applies the logic that is required before writing any translation
program. Also remember that case makes no difference except in constant
declarations. The logic goes as follows:

1. First, you need to declare the input file(s) that you want to translate.

Example: O1=test1.dat
Translation: The first input data file is named test1.dat.

2. Next, you need to declare what type of file it is; of course, if it is
a delimited file with " (char 34) as the delimitor no other information
is needed about the file.

Example: O1=test1.dat,D=[~]
Translation: The first input data file is named test1.dat, it is a
delimited file and the delimitor is a ~ (char 126).

Example: O2=test2.dat,P,B=[@]
Translation: The second input data file is named test2.dat, it is a
position sensitive file and the file is padded with
@ (char 64).

Any padding found within a data range in a position
sensitive file will be stripped from the data range.

3. Then you will declare the output file(s) that you want the data place
into. The syntax is exactly the same as the input file declarations
with the exception of N being used instead of O as the first character.

4. After the data files have been declare it is necessary to decide what
data you want from the input file, where it is, how is it formatted,
where do you want the data placed and how do you want it formatted.


Example: F1=F1
Translation: This is the simpliest that a translation line can be since
it uses defaults. It is translated as follows: field
number 1, from input file 1 (default), is to be placed
into field number 1 in output file 1 (default).

From here it gets more confusing but I will show many different types of
possible translation lines, using the above declared input and output
files.

Field to Field

Example: F1,O1=F1,10,N1
Translation: Place the data from field 1 of input file 1 into field 1
of output file 1 with a maximum length of 10.

Field to Position Sensitive

Example: F1,O1=P,20,10,N2,J=[L]
Translation: Place the data from field1 of input file 1 starting at
position 20 of output file 2, with a length of 10,
justified to the left.

Position Sensitive to Field

Example: P,20,10,O2,J=[L]=F1,10,N1
Translation: Place the data starting at position 20 of input file 2,
with a length of 10, justified to the left, into field 1
of output file 1 with a maximum length of 10.

Position Sensitive to Position Sensitive

Example: P,20,10,O2,J=[L]=P,30,20,N2,J=[R]
Translation: Place the data starting at position 20 of input file 2,
with a length of 10, justified to the left, starting a
position 30 of output file 2, with a length of 20,
justified to the right.

Constant to Field

Example: C=[This is a test]=F1,30,N1
Translation: Place the constant "This is a test" (not changing case)
into field 1 of output file 1, and if the length of the
constant is greater than 30 , truncate the constant.
(the maximum length variable should hardly ever be used
with a constant declaration into a field type).

Constant to Position Sensitive

Example: C=[This is a test]=P,20,20,N2,J=[L]
Transaction: Place the constant "This is a test" (not changing case)
starting at position 20 of output file 2, for a maximum
length of 20, justified to the left.

5. Other things to consider are:

A. By using the \n as part of a constant you can reformat a single line
record into multiline record.

B. Case and white space are unimportant, therefore, you can format
your syntax as you please.

Example: F1,O1=F1,N1 is the same as
f1, o1 = F1 , n1

C. All file declarations do not have to grouped at the begin of your
declaration file, just as long as the file has been declared before
it is referenced in the declaration.

I hope you find this utility of great use and if you have any suggestions or
errors please either fax me a message or send one through CompuServe and I
will try to incorporate them as they seem fit and time allows.









 December 6, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)