Link to home
Start Free TrialLog in
Avatar of Paurths
Paurths

asked on

Cobol Q - Printing

Hi,

seems i have a little problem printing records in cobol.
I use the write-command  and everything works well.
But the printer does not print. I have to manually press a button on my printer to get the paper out.

Is there a command in Cobol that i should be using to do this automatically? Or is it just my printer or Windows / dos ?

Cheers
Ricky
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

That sounds like the print drive or the system.  The open on the print file should give it the connect it needs, and it must be connected if it prints when you press the button.

Is the assign on the printer a logical name or a path?

Cd&
Oh! What kind of printer?

Cd&
Avatar of Paurths
Paurths

ASKER

Hi Cd&,

first : when i print and it has more than 1 page then the first page will start automatically. Only at the last page it stops again and i have to manually press the button on the printer.

second : i'm home and it is a HP Deskjet 600 (also a dinosaur lol)

third : my network is out of order (since i got rid of 2 comps, i only have one left... :-( )
The assign is a logical name.

cheers
Ricky
I sounds like it does not see the end of file.  The close of the print file should be inserting an end of page as well as end of file.

Is this being generated using report writer, or it is just a line sequential file?

Cd&
Avatar of Paurths

ASKER

Hi Cd&,

i think i'll display some of the code here. (btw, it also messes up my pages ....)

       ENVIRONMENT DIVISION.
      *=====================

       INPUT-OUTPUT SECTION.
      *---------------------

       SELECT Lijsten-Lidgeld
         ASSIGN TO PRINTER,
         organization sequential,
         access mode sequential.

-----------------------------------

       DATA DIVISION.
      *==============

        FD Lijsten-Lidgeld         LINAGE 60 LINES,
                                   FOOTING AT 59,
                                   LINES AT TOP 3,
                                   LINES AT BOTTOM 3.
          01 Regel                 PIC X(67).

------------------------------------

       Procedure Division.
      *===================
PERFORM Open-file-Lid;
INITIALIZE lid-rec;
OPEN OUTPUT Lijsten-Lidgeld;
PERFORM Druk-Kopregels;
PERFORM Print-NBetaald UNTIL einde-afdruk-lidgeld;
PERFORM Close-file-lid;


        Print-NBetaald.
      * ---------------

        MOVE LOW-VALUE TO Lidnaam.

        START lid-file KEY >= Lidnaam
           INVALID KEY
               SET einde-afdruk-lidgeld TO TRUE;

        END-START.

        READ lid-file NEXT
           AT END
               SET einde-afdruk-lidgeld TO TRUE;
        END-READ.


        PERFORM UNTIL einde-afdruk-lidgeld;

          IF Lidgeld IN Lid-rec = "N" THEN

             MOVE Lidnr IN Lid-rec TO AfdrukLidnr;
             MOVE LidANaam IN Lid-rec TO AfdrukLidANaam;
             MOVE LidVNaam IN Lid-rec TO AfdrukLidVNaam;
             PERFORM DrukAf;

          END-IF

         READ lid-file NEXT

           AT END

               SET einde-afdruk-lidgeld TO TRUE;

         END-READ

        END-PERFORM.
******
        DrukAf.
      *--------
          WRITE Regel FROM DetailRegel,
               AT EOP
                 PERFORM Druk-Kopregels;
          END-WRITE.

*******

        Druk-Kopregels.
      *----------------
         WRITE Regel FROM KopRegel-1.
         WRITE Regel FROM KopRegel-2 AFTER ADVANCING 3 LINES.
         WRITE Regel FROM KopRegel-3 AFTER ADVANCING 2 LINES.
         MOVE SPACES TO Regel.
         WRITE Regel.
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Just a small remark, are you sure the file is closed and the program has been colsed with a proper exit?
The normal print will buffer the lines and the close should force them to be written to the file/printer.

You could also try to send an escape sequence to the printer to force the closure. This should be mentioned in the printer manual and exists from the character 27 (Escape in ASCII) and some extra digit(s).

Nic;o)
Avatar of Paurths

ASKER

thanx Cd& & Nico,

forcing the final page did it.

btw, first part of exam was not exactly excellent, but i'm satisfied. Had 79%.

i'm also still having trouble with inspect.
I'll try it out a little more, and when i get desperate i'll ask another Q about it explaining exactly what happens (or does not happen lol)

cheers
Ricky
Avatar of Paurths

ASKER

well, i asked the Q anyway :
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=progsoftgen&qid=20132255

in the meantime i'm still trying and dying lol.
it gives me headaches. :-)

cheers
Ricky
Thanks for the A Ricky. :^)

I took a Quick look at the other Q and comment in it later, when I get my emails cousght up.  I think there another approch to solveing that problem.

Cd&
Avatar of Paurths

ASKER

Update on exam:

thanx to both your guidance, i ended # 1 with 85% .
It was amazing to see that the others, with 6 weeks for their exam, and i 3 weeks, where not as far into the language as i.

Update on baby:

dont know if u have noticed in the lounge ( https://www.experts-exchange.com/jsp/qManageQuestion.jsp?qid=20136590 ) , but he, Lars, is born on june 12. he's quite healthy...

cheers
Ricky
Good job on finishing first Rickey!

Being interested and working as hard as you did pays always off!

Nic;o)