Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automatically update a batch file

Status
Not open for further replies.

jfgonzalez

Technical User
Apr 16, 2002
36
US
I'm wondering if existing batch files can be updated if a secondary batch file is updated.

Here's what I have. I have a batch file called 'Cpy_Bill.bat' that my boss wrote. This is what it contains:

cpy_bill 04470832
cpy_bill 91001900

and so forth, down to about 60 lines. The number represents a 'ship to' number so that whenever a new 'ship to' number is added to the AS400 for this vendor, it automatically updates this batch file and adds a new line with this code at the bottom.

I have a second batch file that I use to look for pdf files that are created by our system every evening, copy specific ones by file name (usually based on this 'ship to' number) and then moves them to a specific folder. For this particular customer it goes something like this:

copy e:\systems\pdfoutputall\inv_????_????????_04470832.pdf e:\systems\pdfoutput\production\vendor

copy e:\systems\pdfoutputall\inv_????_????????_91001900.pdf e:\systems\pdfoutput\production\customer

and so on.

Later on in the processing, the pdf files are zipped up and e-mailed to the customer.

This latter batch file is one I've had in place for months, but with this new customer there is no telling when they will add new ship to numbers and I'm at a loss as to how to update my main batch program automatically when the cpy_bill.bat file is updated. Right now I'm updating it manually but I know I can't do that forever. I'd appreciate some advice on how I might approach this.

Thanks,

JFG
 
hello,
im a little confused...your first bat file "cpy_bill.bat" doesnt sound like a batch file at all...looks like it should be more of a txt file with entries of a 'ship to' number....so you end up with a list.

are these numbers randomly generated?

your second part:
copy e:\systems\pdfoutputall\inv_????_????????_04470832.pdf e:\systems\pdfoutput\production\vendor

are the question marks for the "cpy_bill" part of the 'ship to' names?...cause this seems quite constant, for you to be putting in a variable.(im confused here)
also, how do you determine if its a vendor or a customer? seems random.

you can read an entry from the list (cpy_bill 04470832)
and parse out the cpy_bill leaving you with the a variable with that number value....you then plug that into your copy command:
copy e:\systems\pdfoutputall\inv_cpy_bill_PARSEDVARIABLE.pdf e:\systems\pdfoutput\production\vendor

to parse that variable use the set command:
(read the list and set it to 'shipto')
set shipto=%shipto:~9%

this will remove the first 9 characters (cpy_bill ) [space included]

you then can plug %shipto% in to a single copy bat file command

hope that helps?
cdc

 
As far as I know the AS400 uses a Unix DOS which is a little different from MS-DOS.

Please let me know if I have the correct picture.

1) I order from you and tell you to ship to Somewhere, Earth.

2) You type in "12345" in a program?

3) Then that program appends to Cpy_Bill.BAT with "cpy_bill 12345"?

If this correct, can you provide any snippets of code of the program that actually ADDs this "cpy_bill 123.." text to the "Cpy_Bill.BAT"?

--MiggyD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top