Highlighted
Absent Member.
Absent Member.
157 views

[archive] Display and subscripts.

[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
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

RE: [archive] Display and subscripts.

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".
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.