Skip to main content

Runtime error 9/013 when attempting to print to “LPTn:” where the physical printer port is mapped via a NET USE statement on Windows 7

  • February 16, 2013
  • 4 replies
  • 0 views

Created On:  20 April 2011

Problem:

If you move an older application to Windows 7 and you have mapped LPTn to a network printer using "NET USE", and you have ASSIGN TO “LPT1:” (or LPT2: etc) in the SELECT clause of the COBOL program, you may receive run time (RTS) error 9/013 when attempting to access the printer. Yet, if from the command line you physically copy a file to the LPTn port specified in the NET USE statement, it prints.

Resolution:

Assume the following SELECT statement in the COBOL program:
SELECT PRINT-FILE ASSIGN TO "LPT1:"
              FILE STATUS IS FILE-STAT.
And assume the following dos command is set to specify the network printer (possibly in a batch (.bat) file:
NET USE LPT1: \\\\machine-name\\HPLaserJet /persistent:yes
where machine name is the print server with the printer drivers installed, and 'HPLaserJet' is the ‘Share name’ on the ‘Sharing’ tab in the ‘Printer Properties’ of the printer selected from the ‘Devices and Printers’ in Windows 7 on that printer server.
If you're using any version of Net Express 5.1 prior to WrapPack6 or Studio EE 6.0 prior to SP2 you will receive RTS error 9/013 (file not found) when trying to print from the COBOL program running on Windows 7 or Vista.
However, if you were to directly copy a file (eg copy abc.txt LPT1) it would print on the printer specified by the NET USE statement.
The problem was caused by a change within the operating system that was not reflected in the COBOL RTS.
This has been fixed in Net Express 5.1 WS6 and Studio 6.0 EE SP2.  
However, it is strongly advised that this method of printer selection be changed and printing be managed via the PC_PRINTER routines to directly access Windows printing.
A couple of points:
If you only have 1 printer (i.e. you always ASSIGN TO “LPT1:”) then you should consider using the printer_redirection runtime tunable.
Also, the NET USE statement on Windows 7 should be set using Administrator permissions. For example, put the NET USE statement in a batch (.bat) file and when you click on it select ‘Run as Administrator’.
Incident #2511667
Old KB# 33924

#Enterprise
#netexpress
#EnterpriseServer
#StudioEnterpriseEdition
#Server
#COBOL

4 replies

  • Author
  • Rocketeer
  • 19312 replies
  • January 27, 2021
Created On:  20 April 2011

Problem:

If you move an older application to Windows 7 and you have mapped LPTn to a network printer using "NET USE", and you have ASSIGN TO “LPT1:” (or LPT2: etc) in the SELECT clause of the COBOL program, you may receive run time (RTS) error 9/013 when attempting to access the printer. Yet, if from the command line you physically copy a file to the LPTn port specified in the NET USE statement, it prints.

Resolution:

Assume the following SELECT statement in the COBOL program:
SELECT PRINT-FILE ASSIGN TO "LPT1:"
              FILE STATUS IS FILE-STAT.
And assume the following dos command is set to specify the network printer (possibly in a batch (.bat) file:
NET USE LPT1: \\\\machine-name\\HPLaserJet /persistent:yes
where machine name is the print server with the printer drivers installed, and 'HPLaserJet' is the ‘Share name’ on the ‘Sharing’ tab in the ‘Printer Properties’ of the printer selected from the ‘Devices and Printers’ in Windows 7 on that printer server.
If you're using any version of Net Express 5.1 prior to WrapPack6 or Studio EE 6.0 prior to SP2 you will receive RTS error 9/013 (file not found) when trying to print from the COBOL program running on Windows 7 or Vista.
However, if you were to directly copy a file (eg copy abc.txt LPT1) it would print on the printer specified by the NET USE statement.
The problem was caused by a change within the operating system that was not reflected in the COBOL RTS.
This has been fixed in Net Express 5.1 WS6 and Studio 6.0 EE SP2.  
However, it is strongly advised that this method of printer selection be changed and printing be managed via the PC_PRINTER routines to directly access Windows printing.
A couple of points:
If you only have 1 printer (i.e. you always ASSIGN TO “LPT1:”) then you should consider using the printer_redirection runtime tunable.
Also, the NET USE statement on Windows 7 should be set using Administrator permissions. For example, put the NET USE statement in a batch (.bat) file and when you click on it select ‘Run as Administrator’.
Incident #2511667
Old KB# 33924

#Enterprise
#netexpress
#EnterpriseServer
#StudioEnterpriseEdition
#Server
#COBOL

can migrating from Windows Server 2003 to Windows Server 2008 cause this error? Before the move, users on Windows 7 were able to print to a local printer or shared printer to LPT1. After the move, the user get this error. Windows XP workstation are not affected by this move. All file and directory are kept the same. 

 

 


  • Author
  • Rocketeer
  • 19312 replies
  • January 27, 2021
Created On:  20 April 2011

Problem:

If you move an older application to Windows 7 and you have mapped LPTn to a network printer using "NET USE", and you have ASSIGN TO “LPT1:” (or LPT2: etc) in the SELECT clause of the COBOL program, you may receive run time (RTS) error 9/013 when attempting to access the printer. Yet, if from the command line you physically copy a file to the LPTn port specified in the NET USE statement, it prints.

Resolution:

Assume the following SELECT statement in the COBOL program:
SELECT PRINT-FILE ASSIGN TO "LPT1:"
              FILE STATUS IS FILE-STAT.
And assume the following dos command is set to specify the network printer (possibly in a batch (.bat) file:
NET USE LPT1: \\\\machine-name\\HPLaserJet /persistent:yes
where machine name is the print server with the printer drivers installed, and 'HPLaserJet' is the ‘Share name’ on the ‘Sharing’ tab in the ‘Printer Properties’ of the printer selected from the ‘Devices and Printers’ in Windows 7 on that printer server.
If you're using any version of Net Express 5.1 prior to WrapPack6 or Studio EE 6.0 prior to SP2 you will receive RTS error 9/013 (file not found) when trying to print from the COBOL program running on Windows 7 or Vista.
However, if you were to directly copy a file (eg copy abc.txt LPT1) it would print on the printer specified by the NET USE statement.
The problem was caused by a change within the operating system that was not reflected in the COBOL RTS.
This has been fixed in Net Express 5.1 WS6 and Studio 6.0 EE SP2.  
However, it is strongly advised that this method of printer selection be changed and printing be managed via the PC_PRINTER routines to directly access Windows printing.
A couple of points:
If you only have 1 printer (i.e. you always ASSIGN TO “LPT1:”) then you should consider using the printer_redirection runtime tunable.
Also, the NET USE statement on Windows 7 should be set using Administrator permissions. For example, put the NET USE statement in a batch (.bat) file and when you click on it select ‘Run as Administrator’.
Incident #2511667
Old KB# 33924

#Enterprise
#netexpress
#EnterpriseServer
#StudioEnterpriseEdition
#Server
#COBOL
You don't say where the code is running, on the desktop or on the server? If it's running locally I can't think of a reason that an OS upgrade on the server would effect code running at the desktop, not to say there may not be one.

Have you looked at the Microsoft site to see if they have any info on differences in printing behavior between the versions of the OS

  • Author
  • Rocketeer
  • 19312 replies
  • January 27, 2021
Created On:  20 April 2011

Problem:

If you move an older application to Windows 7 and you have mapped LPTn to a network printer using "NET USE", and you have ASSIGN TO “LPT1:” (or LPT2: etc) in the SELECT clause of the COBOL program, you may receive run time (RTS) error 9/013 when attempting to access the printer. Yet, if from the command line you physically copy a file to the LPTn port specified in the NET USE statement, it prints.

Resolution:

Assume the following SELECT statement in the COBOL program:
SELECT PRINT-FILE ASSIGN TO "LPT1:"
              FILE STATUS IS FILE-STAT.
And assume the following dos command is set to specify the network printer (possibly in a batch (.bat) file:
NET USE LPT1: \\\\machine-name\\HPLaserJet /persistent:yes
where machine name is the print server with the printer drivers installed, and 'HPLaserJet' is the ‘Share name’ on the ‘Sharing’ tab in the ‘Printer Properties’ of the printer selected from the ‘Devices and Printers’ in Windows 7 on that printer server.
If you're using any version of Net Express 5.1 prior to WrapPack6 or Studio EE 6.0 prior to SP2 you will receive RTS error 9/013 (file not found) when trying to print from the COBOL program running on Windows 7 or Vista.
However, if you were to directly copy a file (eg copy abc.txt LPT1) it would print on the printer specified by the NET USE statement.
The problem was caused by a change within the operating system that was not reflected in the COBOL RTS.
This has been fixed in Net Express 5.1 WS6 and Studio 6.0 EE SP2.  
However, it is strongly advised that this method of printer selection be changed and printing be managed via the PC_PRINTER routines to directly access Windows printing.
A couple of points:
If you only have 1 printer (i.e. you always ASSIGN TO “LPT1:”) then you should consider using the printer_redirection runtime tunable.
Also, the NET USE statement on Windows 7 should be set using Administrator permissions. For example, put the NET USE statement in a batch (.bat) file and when you click on it select ‘Run as Administrator’.
Incident #2511667
Old KB# 33924

#Enterprise
#netexpress
#EnterpriseServer
#StudioEnterpriseEdition
#Server
#COBOL

Hello SteveW2. The INT and source code is on the server. The desktop has micro focus installed on it so it can use the RUNW.exe to run the INT file that is on the server. 

 

 


  • Author
  • Rocketeer
  • 19312 replies
  • March 4, 2021
Created On:  20 April 2011

Problem:

If you move an older application to Windows 7 and you have mapped LPTn to a network printer using "NET USE", and you have ASSIGN TO “LPT1:” (or LPT2: etc) in the SELECT clause of the COBOL program, you may receive run time (RTS) error 9/013 when attempting to access the printer. Yet, if from the command line you physically copy a file to the LPTn port specified in the NET USE statement, it prints.

Resolution:

Assume the following SELECT statement in the COBOL program:
SELECT PRINT-FILE ASSIGN TO "LPT1:"
              FILE STATUS IS FILE-STAT.
And assume the following dos command is set to specify the network printer (possibly in a batch (.bat) file:
NET USE LPT1: \\\\machine-name\\HPLaserJet /persistent:yes
where machine name is the print server with the printer drivers installed, and 'HPLaserJet' is the ‘Share name’ on the ‘Sharing’ tab in the ‘Printer Properties’ of the printer selected from the ‘Devices and Printers’ in Windows 7 on that printer server.
If you're using any version of Net Express 5.1 prior to WrapPack6 or Studio EE 6.0 prior to SP2 you will receive RTS error 9/013 (file not found) when trying to print from the COBOL program running on Windows 7 or Vista.
However, if you were to directly copy a file (eg copy abc.txt LPT1) it would print on the printer specified by the NET USE statement.
The problem was caused by a change within the operating system that was not reflected in the COBOL RTS.
This has been fixed in Net Express 5.1 WS6 and Studio 6.0 EE SP2.  
However, it is strongly advised that this method of printer selection be changed and printing be managed via the PC_PRINTER routines to directly access Windows printing.
A couple of points:
If you only have 1 printer (i.e. you always ASSIGN TO “LPT1:”) then you should consider using the printer_redirection runtime tunable.
Also, the NET USE statement on Windows 7 should be set using Administrator permissions. For example, put the NET USE statement in a batch (.bat) file and when you click on it select ‘Run as Administrator’.
Incident #2511667
Old KB# 33924

#Enterprise
#netexpress
#EnterpriseServer
#StudioEnterpriseEdition
#Server
#COBOL

I did not understand where the code is running, on the desktop or on the server? Did the Microsoft site provide info about different printers?