Solved

nest a count loop in a for loop

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

914 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

14 Experts available now in Live!

Get 1:1 Help Now