[Migrated content. Thread originally posted on 09 May 2006]
I have lines I wish to display on a screen ie
01 Print-lines.
03 pline1 pic x(80) value a.
03 pline2 pic x(80) value b.
.
. etc.
I read a variable "varno" with a value 1-9 which tells me which line to print, ie
1 = pline1
5 = pline5
Without doing multiple If statements, can I somehow string "pline" "varno" to make a single print statement which will print any line?
TIA
Ian Warner
IAN
Try this, Nothing will be lost !
77 x p?c 99.
77 x-aux pic x(90).
77 txt pic x(80).
78 78-max-prt-llines value 6.
01 print-lines.
03 item-1 pic x(80) value 'A'.
03 item-2 pic x(80) value 'B'.
03 item-1 pic x(80) value 'C'. | continues to 6
01 filler redefines print-lines.
03 item-to-prt pic x(80) occurs 78-max-prt-lines.
perform test after varying x from 1 by 1 until x = 78-max-prt-lines
if x = varnro
move spaces to x-aux
string item-to-prt(x) ' ' varnro
delimited size into x-aux
end-if
end-perform
*** If you want to remove trailing spaces on item-to-prt then use:
move item-to-prt(x) to txt
inspect txt replacing trailing spaces by x'00'
move spaces to x-aux
string txt delimited x'00'
' ' delimited size
varnro delimited size
into x-aux
*************************************************
CB52 from "The Pampas".