[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Another Call System Question



My first idea: PRINT is a weird program, don't use it.  Instead COPY filename LPT1

If that doesn't help, the second idea is to make sure that your second run actually produces a file. Then, instead of executing these commands via individual calls to system, build a batch file and execute it all at once.

BTW, I do this using LPT2 ... you never know what the client might have had LPT1 set to when you captured it, and so when you un-capture it you might not be restoring what's supposed to be there.

Another possible problem ... SQR is actually making an SPF file, and doesn't create the LIS file until you are done and either exit or do a new-report.  It is possible the .LIS file does not yet exist when you try to print it.  Is the second file a big one?  You could execute "if not exist filename echo File Not There" to test this.  If you need it, I have a "delay" program you can use to wait a few seconds.  Or you could put the delay in your program. Remember too that existence of the file is not enough ... you need to wait until SQR is _finished_ making it before you start to print.

Dave

At 02:02 PM 9/8/1999 -0400, you wrote:
>SQR 4
>NT4.0 SP4
>
>This is my 1st time using the CALL SYSTEM command, and I'm getting some
>undesirable results.  I'm hoping someone can help me.
>
>Both our Client machines and Servers are NT4.0 SP4.
>
>Our Client setup is such that the LPT1 port is not captured (not an option to
>change).  What I'm attempting to do is:
>1) Rename the *.lis file (no problem, this works)
>2) Capture the LPT1 port
>3) use SYSTEM PRINT command to print the *.lis file to a specified printer
>4) uncapture LPT1 port
>
>The problem is that the printing of the SQR to the printer only works once.  If
>I run the SQR again, nothing happens.  (I have used both command.com and cmd.exe
>in the $Call_Str variable, no difference)
>
>See below for example.  The SQR complies correctly and runs to completion (I
>believe)
>
>Program Code:
>
>move '\\caigdc001\HP4_03' to $Client_Printer    !Network Path to Printer
>move 'TESTSQR.SQR' to $ReportID
>move 'C:\temp\' to $SQRpath
>
>Begin-Procedure Rename-Lis-File
>!This procedure works fine.
>    Do   Format-DateTime($sysdatetime,$runtime,{defcmp},'time','')
>    let $Rpt_Name = $SQRpath || $ReportID || '_' || $runtime || '.lis'
>    new-report $Rpt_name
>End-Procedure Rename-Lis-File
>
>Begin-Procedure Print-Lis-File
>  !Map LPT1
>    show 'Mapping LPT1 to ' $Client_Printer
>    let $Call_Str = 'command.com /C net use lpt1 ' || $Client_Printer
>    call system using $Call_Str #Return_Value WAIT
>    show 'command/return: '  $Call_Str ', ' #Return_Value
>
>  !Print file using system print command
>    show
>    show 'Printing file:  ' $Rpt_name '
>    let $Call_Str = 'command.com /C print ' || $Rpt_Name
>    call system using $Call_Str #Return_Value WAIT
>    show 'command/return: '  $Call_Str ', ' #Return_Value
>
>  !Release LPT1
>    show
>    show 'Releasing LPT1'
>    let $Call_Str = 'command.com /C net use lpt1 /D '
>    call system using $Call_Str #Return_Value WAIT
>    show 'command/return: '  $Call_Str ', ' #Return_Value
>
>End-Procedure
>
>Log File:
>
>Please press ENTER (Do not input a value):
>Mapping LPT1 to \\caigdc001\HP4_03
>command/return: command.com /C net use lpt1 \\caigdc001\HP4_03, 5.000000
>
>Printing file:  C:\temp\smrtest_19990908134112.lis
>command/return: command.com /C print C:\temp\smrtest_19990908134112.lis,
>5.000000
>
>Releasing LPT1
>command/return: command.com /C net use lpt1 /D , 5.000000
>
>SQR: End of Run.
>
>
>Any input would be appreciated.
>
>Thanks
>Shawn
>
Dave Donnelly           <dave@isisbio.com>  or  <isisdave@usa.net>
ISIS BioComp            phone (909) 677-2446      fax (909) 677-3991