Hi,
Some of this I can't help with at this time (kinda rushed to experiment), but just as a check, did you try running your code at a DOS command prompt? Make sure it works there first, then it will likely work inside SQR. Also note that cmd.exe and command.com do have some differences in behavior, so if you might run on either environment, check your code at the DOS prompt for both command processors.
I've just finished identifying that, whereas 'command.com /C copy ...' works fine, I need to specify the path for the move command, as in 'command.com /C c:\windows\command\move ...' Go figure!
Bob
-----Original Message-----
From: Shawn Robinson [mailto:Shawn.Robinson@CAMI.CA]
Sent: Wednesday, September 08, 1999 2:02 PM
To: Multiple recipients of list SQR-USERS
Subject: Another Call System Question
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