Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

nest a count loop in a for loop

Posted on 2003-10-24
2
Medium Priority
?
785 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

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…
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

618 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