How do I eliminate the blank lines in a DISPLAY statement when using a group header? For example:
DEFINE DATA LOCAL
1 #DATA (A10/1:2) INIT <'ABC12','DEF34'>
1 #GROUP (HD='GRP')
2 #SUB-FIELD1 (A1) (HD='SF1')
2 #SUB-FIELD2 (A1) (HD='SF2')
2 #SUB-FIELD3 (A1) (HD='SF3')
1 #FIELD1 (A1) (HD='//F1')
1 #FIELD2 (A1) (HD='//F2')
1 #X (I4)
END-DEFINE
FOR #X = 1 TO 2
MOVE SUBSTR(#DATA(#X),1,1) TO #GROUP.#SUB-FIELD1
MOVE SUBSTR(#DATA(#X),2,1) TO #GROUP.#SUB-FIELD2
MOVE SUBSTR(#DATA(#X),3,1) TO #GROUP.#SUB-FIELD3
MOVE SUBSTR(#DATA(#X),4,1) TO #FIELD1
MOVE SUBSTR(#DATA(#X),5,1) TO #FIELD2
DISPLAY NOTITLE (GC=-) #GROUP #FIELD1 #FIELD2
END-FOR
END
Produces the following output:
----GRP----
SF1 SF2 SF3 F1 F2
--- --- --- -- --
A B C 1 2
D E F 3 4
1) How do I get rid of the blank line after ----GRP----? 2) Is there a way to get rid of the blank line that appears before the first row of data? (I think this blank line appears regardless of whether or not a group header is being used) Also, is there a way to use a fixed-width font when posting questions in this forum? The HTML
Actually, the answer to your 2nd question is “Yes” …
A2. You can turn off the Underline Character. DISPLAY (UC=OFF) will “get rid of the blank line which appears before the first row of data”.
NB. But it will also “get rid of” the underlines below the column headers.
So the output will look like this:
----GRP----
the (HD=…) declarations are still required, even though the WRITE TITLE is now defining the “column header” texts
the “column header widths” must be the same in the (HD=…) and the WRITE TITLE texts. otherwise your data rows may not line up nicely under the column headers.
.
For example, if you comment out the (HD=…) definitions in Steve’s program then the DISPLAY’s column widths will default back to the length of the field names.