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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Top/Bottom Justification

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Does anyone know how I could set up an array to Top or Bottom Justify address data in an address block?


Example:

Input Data:
Line 1 Mr. John Q. Sample
Line 2
Line 3 1234 Any Street
Line 4 Anytown, US 99999

Desired Top Justified Output Data:
Line 1 Mr. John Q. Sample
Line 2 1234 Any Street
Line 3 Anytown, US 99999
Line 4

Desired Bottom Justified Output Data:
Line 1
Line 2 Mr. John Q. Sample
Line 3 1234 Any Street
Line 4 Anytown, US 99999
 
I don't fully follow where the data is coming from. Is it already in the array and you want to output it to paper or screen?

You can create an object with 4 string variables,
one for each line and read the data out of the array.

Write an output function like this:

if Line4 = "" then
PrintLine Line4
PrintLine Line1
PrintLine Line2
PrintLine Line3
else
PrintLine Line1
PrintLine Line2
PrintLine Line3
PrintLine Line4
endif

where PrintLine is a function that outputs a string to your
desired medium and puts a blank line if the input string is
empty.

If you're trying to put data into the array, rewrite PrintLine so it assigns to the next array slot instead of output to a medium.

scarfhead
 
The data is coming in from a line sequential file. I want to feed the information into the array and write it out to an output file.

I have tried the above suggestion and it works but I want to streamline it to run faster.

Any other suggestions?

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top