Menu

Cannot print to LPT1 or LPT2

Anonymous
2019-09-22
2019-09-23
  • Anonymous

    Anonymous - 2019-09-22

    All attempts to open a file assigned to LPT1 or LPT2 result in "libcob: permanent file error (status = 30) file: 'LPT1' ]or 'LPT2']". The following sample program will illustrate the problem. (I'm using GC30r2793-VBI-rename-7z-to-exe.exe. I cannot use GC31 because it ignores highlight, amonst other problems.)

    ::cobol
    00001  IDENTIFICATION DIVISION.
    00002  PROGRAM-ID.    LPT1TEST.
    00003
    00004  ENVIRONMENT DIVISION.
    00005  CONFIGURATION SECTION.
    00006  SOURCE-COMPUTER. IBM-PC.
    00007  OBJECT-COMPUTER. IBM-PC.
    00008
    00009  INPUT-OUTPUT SECTION.
    00010  FILE-CONTROL.
    00011      SELECT REPORT-FILE        ASSIGN TO PRINTER-NAME
    00012                                organization is line sequential.
    00013
    00014  DATA DIVISION.
    00015  FILE SECTION.
    00016  FD  REPORT-FILE
    00017      LABEL RECORDS ARE OMITTED.
    00018
    00019  01  RPT-RECORD PIC X(132).
    00020
    00021  WORKING-STORAGE SECTION.
    00022
    00023  01  PRINTER-NAME            PIC X(07)   VALUE "LPT1".
    00024  01  ASCII-Z-TERMINATOR      PIC X(01)   VALUE LOW-VALUES.        8/10/93
    00025
    00026  PROCEDURE DIVISION.
    00027
    00028  000-MAINLINE SECTION.
    00029  000-ENTRY.
    00030      OPEN OUTPUT REPORT-FILE. *>fs error 30 occurs here!
    00031
    00032      STOP RUN.
    

    libcob: permanent file error (status = 30) file: 'LPT1'

     

    Last edit: Simon Sobisch 2019-09-23
  • cdg

    cdg - 2019-09-22

    Please ignore and/or delete this post. The problem was that the "net use" assignment for LPT1 and LPT2 was somehow deleted, so Windoze was unaware of their existence. Still, a file system error 92 would have made more sense, and isolated the problem more quickly.

     

    Last edit: cdg 2019-09-22
    • Simon Sobisch

      Simon Sobisch - 2019-09-23

      What is an error 92 (all 9x are implementor defined)?

       
  • cdg

    cdg - 2019-09-23

    92=File not found (with Realia Cobol), which is the closest code for this situation (since it couldn't find LPT1/2). I wasn't aware that the 9x codes vary with the compiler.

     

    Last edit: cdg 2019-09-23
    • Simon Sobisch

      Simon Sobisch - 2019-09-23

      Actually for this value the defined i-o-status would be either status 35 or 37. Quoting from ANSI85 (identical in COBOL 2002 and likely also identical for later revisions):

      I-O status = 35. A permanent error exists because an OPEN statement with the INPUT, I-O, or EXTEND phrase is attempted on a file that is not described as optional and the physical file is not present.
      I-O status = 37. A permanent error exists because an OPEN statement is attempted on a file and that file will not support the open mode specified in the OPEN statement [...] EXTEND or OUTPUT phrase [...] but the file will not support write operations.

      This is actually what is returned by GnuCOBOL if the underlying C runtime reports there is no access possible. The fallback for any fatal error is:

      I-O status = 30. A permanent error exists and no further information is available concerning the input-output operation.

      I've just rechecked: this happens in your LPT2-case because the C function access() says "everything is fine "file" can be accessed" and the following fopen() with requested "write" mode reports "ENOENT: 2 - No such file or directory"; this combination is more than strange and "file not found" for OPEN-OUTPUT sounds wrong, too.

       

Anonymous
Anonymous

Add attachments
Cancel