Solved

nest a count loop in a for loop

Posted on 2003-10-24
2
777 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
Windows Batch Script to Delete Time-Stamped Folders 3 110
dsquery command line assistance 2 127
how to run a batch process 16 50
Seatools For Dos (Just shows FreeDos) 21 94
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

726 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