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

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