185 pts.
 how to use a printer file in a program cobol
hi,

how to use a printer file in a program cobol.

i have the following:

(I wanna know if the write part is correct) 

MOVE M1DESC TO M1DESC-DSP.            MOVE M1DESC-DSP TO R1DESC-PRT.        MOVE PRINTER-LINE TO HIPR01R-RECORD.

 WRITE HIPR01R-RECORD FROM PRINTER-LINE.

Regards

Sylvana.



Software/Hardware used:
os/400
ASKED: November 9, 2009  5:50 PM
UPDATED: November 27, 2009  8:45 AM

Answer Wiki:
you may want to add this after the WRITE instruction AFTER ADVANCING 1 LINE
Last Wiki Answer Submitted:  November 9, 2009  6:35 pm  by  CharlieBrowne   33,695 pts.
All Answer Wiki Contributors:  CharlieBrowne   33,695 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

It depends on the printer file. Without seeing the printer file definition of the print line identified as HIPR01R-RECORD, there’s no way to know. (AFTER ADVANCING 1 LINE would be the default behavior.)

How many record formats are defined? Is the printer file externally described?

Tom

 110,115 pts.

 

BTW, if you have this line:

MOVE PRINTER-LINE TO HIPR01R-RECORD.

…then this line:

 WRITE HIPR01R-RECORD FROM PRINTER-LINE

…should only need to be:

WRITE HIPR01R-RECORD

You don’t need the FROM if you’ve already done the MOVE. Also, if you do use the FROM, then you don’t need the MOVE. Use one or the other rather than using both.

Tom

 110,115 pts.