Kbase 6297: How to print data in three columns
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
How to print data in three columns
910830-cmb01
INTRODUCTION:
=============
This Technical Support KnowledgeBase entry explains
how to print data in three columns in your output. This is very
useful for printing labels.
PROCEDURAL APPROACH:
====================
DEFINE VARIABLE num-up AS INTEGER INITIAL 3. /* This example creates
3 columns. You can set
this number to whatever
you want. Just remember
to change the following
lines */
DEFINE VARIABLE line1 AS CHARACTER EXTENT 3 FORMAT "x(25)".
DEFINE VARIABLE line2 AS CHARACTER EXTENT 3 FORMAT "x(25)".
DEFINE VARIABLE line3 AS CHARACTER EXTENT 3 FORMAT "x(25)".
DEFINE VARIABLE line4 AS CHARACTER EXTENT 3 FORMAT "x(25)".
DEFINE VARIABLE no-more AS LOGICAL INITIAL FALSE.
DEFINE VARIABLE i AS INTEGER. /* This is the array counter */
DEFINE VARIABLE j AS INTEGER.
OUTPUT TO PRINTER PAGE-SIZE 99999. /* This is where your output statement
belongs */
cust-loop:
REPEAT FOR customer
PRESELECT EACH customer BY zip: /*You don't need this preselect if
/* you won't need to sort your data
/* This example formats labels with 4 address lines and 1 blank
line */
FORM SKIP(1) line1 SKIP line2 SKIP line3 SKIP line4 SKIP(1)
WITH NO-BOX NO-LABELS NO-ATTR-SPACE DOWN.
label-set:
REPEAT i = 1 TO num-up:
FIND NEXT customer NO-ERROR.
IF NOT AVAILABLE customer THEN DO:
no-more = TRUE.
/* blank out lines not filled with new customers */
DO j = i TO num-up:
line1[j] = "".
line2[j] = "".
line3[j] = "".
line4[j] = "".
END.
LEAVE label-set.
END.
line1[i] = name.
line2[i] = address.
IF address2 = "" THEN DO:
line3[i] = city + ", " + st + " " + STRING(zip,"99999").
line4[i] = "".
END.
ELSE DO:
line3[i] = address2.
line4[i] = city + ", " + st + " " + STRING(zip,"99999").
END.
END. /* label-set */
IF i > 1 THEN DISPLAY line1 line2 line3 line4.
IF no-more THEN LEAVE cust-loop.
END. /* cust-loop */
ONLINE PROCEDURES OR UTILITIES:
===============================
PROGRESS Procedure Library Convert Utility "mail-lbl.p"
REFERENCES TO WRITTEN DOCUMENTATION:
====================================
PROGRESS Language Reference
Progress Software Technical Support Note # 6297