Solved

nest a count loop in a for loop

Posted on 2003-10-24
2
773 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now