Discussion:
Remove Decimal in Batch File
(too old to reply)
M***@gmail.com
2007-10-11 16:42:21 UTC
Permalink
I created a batch file which displays a dollar amount, but I need to
remove the decimal. Any idea on I would accomplish this?

Thanks in advance
Pegasus
2007-10-11 16:52:02 UTC
Permalink
Post by M***@gmail.com
I created a batch file which displays a dollar amount, but I need to
remove the decimal. Any idea on I would accomplish this?
Thanks in advance
Let's have a look at your batch file (and possibly at
your data file).
M***@gmail.com
2007-10-11 17:02:33 UTC
Permalink
Post by Pegasus
Post by M***@gmail.com
I created a batch file which displays a dollar amount, but I need to
remove the decimal. Any idea on I would accomplish this?
Thanks in advance
Let's have a look at your batch file (and possibly at
your data file).
Here are the data files:

DR-Header reads -
"HDR",2007-10-10 15:05:49

DR-Results reads -
DDA123456789,DDA,DDA123456789,,38684,1,126.67,,2007-10-10
15:05:49,Successful, 10

DR-Footer reads-
"EOF",1,126.67,"10/10/2007 3:05:49 PM"

Here is the batch file:

@echo off
copy /b "DR-Header.txt" "PYMTRSLT.txt"
type "I:\DATA\MIS\IAC\DebtResolve\Results\DR-Results.txt" >> "I:\DATA
\MIS\IAC\DebtResolve\Results\PYMTRSLT.txt";
for /F %%A in ("DR-Results.txt") do If %%~zA equ 0 type "I:\DATA\MIS
\IAC\DebtResolve\Results\DR-NO DATA.txt" >> "I:\DATA\MIS\IAC
\DebtResolve\Results\PYMTRSLT.txt";
type "I:\DATA\MIS\IAC\DebtResolve\Results\DR-Footer.txt" >> "I:\DATA
\MIS\IAC\DebtResolve\Results\PYMTRSLT.txt";
del /s "DR-Header.txt"
del /s "DR-Footer.txt"
del /s "DR-Results.txt"
eof
Pegasus
2007-10-11 18:20:27 UTC
Permalink
Post by M***@gmail.com
Post by Pegasus
Post by M***@gmail.com
I created a batch file which displays a dollar amount, but I need to
remove the decimal. Any idea on I would accomplish this?
Thanks in advance
Let's have a look at your batch file (and possibly at
your data file).
DR-Header reads -
"HDR",2007-10-10 15:05:49
DR-Results reads -
DDA123456789,DDA,DDA123456789,,38684,1,126.67,,2007-10-10
15:05:49,Successful, 10
DR-Footer reads-
"EOF",1,126.67,"10/10/2007 3:05:49 PM"
@echo off
copy /b "DR-Header.txt" "PYMTRSLT.txt"
type "I:\DATA\MIS\IAC\DebtResolve\Results\DR-Results.txt" >> "I:\DATA
\MIS\IAC\DebtResolve\Results\PYMTRSLT.txt";
for /F %%A in ("DR-Results.txt") do If %%~zA equ 0 type "I:\DATA\MIS
\IAC\DebtResolve\Results\DR-NO DATA.txt" >> "I:\DATA\MIS\IAC
\DebtResolve\Results\PYMTRSLT.txt";
type "I:\DATA\MIS\IAC\DebtResolve\Results\DR-Footer.txt" >> "I:\DATA
\MIS\IAC\DebtResolve\Results\PYMTRSLT.txt";
del /s "DR-Header.txt"
del /s "DR-Footer.txt"
del /s "DR-Results.txt"
eof
Maybe I'm going blind but where are the Dollars? Also:
the last command ("eof") will generate an error message
unless you have a command on your PC that's called eof.com,
eof.exe, eof.bat etc.
M***@gmail.com
2007-10-11 19:33:18 UTC
Permalink
Post by Pegasus
Post by M***@gmail.com
Post by Pegasus
Post by M***@gmail.com
I created a batch file which displays a dollar amount, but I need to
remove the decimal. Any idea on I would accomplish this?
Thanks in advance
Let's have a look at your batch file (and possibly at
your data file).
DR-Header reads -
"HDR",2007-10-10 15:05:49
DR-Results reads -
DDA123456789,DDA,DDA123456789,,38684,1,126.67,,2007-10-10
15:05:49,Successful, 10
DR-Footer reads-
"EOF",1,126.67,"10/10/2007 3:05:49 PM"
@echo off
copy /b "DR-Header.txt" "PYMTRSLT.txt"
type "I:\DATA\MIS\IAC\DebtResolve\Results\DR-Results.txt" >> "I:\DATA
\MIS\IAC\DebtResolve\Results\PYMTRSLT.txt";
for /F %%A in ("DR-Results.txt") do If %%~zA equ 0 type "I:\DATA\MIS
\IAC\DebtResolve\Results\DR-NO DATA.txt" >> "I:\DATA\MIS\IAC
\DebtResolve\Results\PYMTRSLT.txt";
type "I:\DATA\MIS\IAC\DebtResolve\Results\DR-Footer.txt" >> "I:\DATA
\MIS\IAC\DebtResolve\Results\PYMTRSLT.txt";
del /s "DR-Header.txt"
del /s "DR-Footer.txt"
del /s "DR-Results.txt"
eof
the last command ("eof") will generate an error message
unless you have a command on your PC that's called eof.com,
eof.exe, eof.bat etc.- Hide quoted text -
- Show quoted text -
The dollar amount is 1,126.67 and is listed in the DR-Results and DR-
Footer.

I have been running this batch for months without an errors. The eof
is in quotes therefore is generated as the letters EOF which is needed
on the text file for our vendor.
Pegasus
2007-10-11 20:35:04 UTC
Permalink
Post by M***@gmail.com
Post by Pegasus
Post by M***@gmail.com
Post by Pegasus
Post by M***@gmail.com
I created a batch file which displays a dollar amount, but I need to
remove the decimal. Any idea on I would accomplish this?
Thanks in advance
Let's have a look at your batch file (and possibly at
your data file).
DR-Header reads -
"HDR",2007-10-10 15:05:49
DR-Results reads -
DDA123456789,DDA,DDA123456789,,38684,1,126.67,,2007-10-10
15:05:49,Successful, 10
DR-Footer reads-
"EOF",1,126.67,"10/10/2007 3:05:49 PM"
@echo off
copy /b "DR-Header.txt" "PYMTRSLT.txt"
type "I:\DATA\MIS\IAC\DebtResolve\Results\DR-Results.txt" >> "I:\DATA
\MIS\IAC\DebtResolve\Results\PYMTRSLT.txt";
for /F %%A in ("DR-Results.txt") do If %%~zA equ 0 type "I:\DATA\MIS
\IAC\DebtResolve\Results\DR-NO DATA.txt" >> "I:\DATA\MIS\IAC
\DebtResolve\Results\PYMTRSLT.txt";
type "I:\DATA\MIS\IAC\DebtResolve\Results\DR-Footer.txt" >> "I:\DATA
\MIS\IAC\DebtResolve\Results\PYMTRSLT.txt";
del /s "DR-Header.txt"
del /s "DR-Footer.txt"
del /s "DR-Results.txt"
eof
the last command ("eof") will generate an error message
unless you have a command on your PC that's called eof.com,
eof.exe, eof.bat etc.- Hide quoted text -
- Show quoted text -
The dollar amount is 1,126.67 and is listed in the DR-Results and DR-
Footer.
I have been running this batch for months without an errors. The eof
is in quotes therefore is generated as the letters EOF which is needed
on the text file for our vendor.
The following batch file will remove the decimal point from the single
text line in DR-Headers.txt before appending it to your output file:

for /F "delims=" %%a in (DR-Headers.txt) do set Line=%%a
echo %Line:.=% >> "I:\DATA\MIS\IAC\DebtResolve\Results\PYMTRSLT.txt";

Your reply about the "eof" command does not make sense. If this
string is required in the text file for your vendor, what is it doing
at the end of the batch file? Perhaps you have been overlooking
this error for months because it happens right at the end, before
the window closes.

The code fragment "for /F %%A in ("DR-Results.txt")" is not as
robust as it should be because it relies on the file "DR-Results.txt"
being in the current directory. To make it robust you should state
the full path.

Loading...