Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

display statement 1

Status
Not open for further replies.

D2BEA

Technical User
Mar 13, 2001
41
US
How do I print an output file with mulitple records to the screen? When I use display, only one records appears.
 
you could try editing the data as you would with a printfile making sure that the width of your row is within screen limitations eg:

working-storage section.

01 group-for-screen-output.
03 rec-details-a pic(whatever).
03 filler pic(whatever) value spaces.
03 rec-details-b pic(whatever).
03 filler pic(whatever) value spaces.
etc...

then try using a loop like this:

procedure division.

read output-file at end move "y" to eof-flag

perform until eof-flag = "y"
{move data to group-for-screen-output}
display group-for-screen-output
{read next record }
end-perform.

this is only a suggestion, i haven't actually tried it!
please let me know if it works
i hope i've helped
jim lee
 
hello, it's me again .
i've just trried the method i suggested above with the coding below and it seems to work o.k.
the only problem is that you are limited to the width of the compilers screen window(whatever its called!) whereas printouts are often wider that this and therefore will wrap onto the next line on your screen making it a bit confusing.

anyway, here is the code i used:

environment division.
input-output section.
file-control.
select output-file assign to "rubbish.dat"
organization line sequential.


data division.

file section.
fd output-file.
01 out-rec.
03 num-1 pic x(4).
03 num-2 pic x(4).
03 num-3 pic x(4).

working-storage section.

01 group-for-screen-output.
03 rec-details-a pic x(4).
03 filler pic x(4) value spaces.
03 rec-details-b pic x(4).
03 filler pic x(4) value spaces.
03 rec-details-c pic x(4).

01 eof-flag pic x value "n" .

procedure division.
open input output-file

read output-file at end
move "y" to eof-flag
not at end
perform until eof-flag = "y"
move num-1 to rec-details-a
move num-2 to rec-details-b
move num-3 to rec-details-c
display group-for-screen-output

read output-file at end move "y" to eof-flag

end-perform
end-read
close output-file

stop run.

and here is the layout of the "rubbish.dat" output-file that i used:

one two thre
fourfivesix
seveeighnine

see ya
jimlee (student)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top