Solved

nest a count loop in a for loop

Posted on 2003-10-24
2
776 Views
Last Modified: 2008-02-01
I have a script that reads from a file a line at a time.
Lines in the file are like this:  Studentid          #copies
Currently, the batch calls oracle reports and passes SID and #copies as parameters.
Unfortunately, there's a bug in Reports and it doesn't properly print multiple copies. (They run together when duplexed)
Sooooo  I need to loop count the #copies and call Reports for #copies as well as for each SID.
I can't figure out how to plug in the copies counting. Any ideas?

Thanks.

The relevant part of the batch looks like this


@echo on
FOR /F "tokens=1,2" %%I in (e:\Transcripts\infiles\transin) DO (
COPIES = %%J
C:\orant\bin\rwrun60.exe module=e:\Transcripts\Tran_prod\rdfs\transcript.rdf BATCH=YES DESTYPE=PRINTER DESFORMAT=PDF DESNAME=regbonnie ERRFILE=err_file P_SID=%%I )

0
Comment
Question by:rebeccap
  • 2
2 Comments
 
LVL 8

Expert Comment

by:K_2K
ID: 9618602
This might be what you're looking for,  if rwrun60.exe uses the COPIES variable.

@echo on
FOR /F "tokens=1,2" %%I in (e:\Transcripts\infiles\transin) DO (
    SET /a COPIES=%%J
    C:\orant\bin\rwrun60.exe module=e:\Transcripts\Tran_prod\rdfs\transcript.rdf BATCH=YES DESTYPE=PRINTER DESFORMAT=PDF DESNAME=regbonnie ERRFILE=err_file P_SID=%%I
)

0
 
LVL 8

Accepted Solution

by:
K_2K earned 250 total points
ID: 9618609
If you need to run the command a separate time to get each copy, this should do it:

@echo on
FOR /F "tokens=1,2" %%I in (e:\Transcripts\infiles\transin) DO (
    FOR /L %%K in (1,1,%%J) do (
        C:\orant\bin\rwrun60.exe module=e:\Transcripts\Tran_prod\rdfs\transcript.rdf BATCH=YES DESTYPE=PRINTER DESFORMAT=PDF DESNAME=regbonnie ERRFILE=err_file P_SID=%%I
    )
)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

827 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