|
>Date: Tue, 20 Jun 2000 11:44:41 -0700 >From: Jim Langston <jlangston@conexfreight.com> > >I have a report to generate that has quite a bit of text on it. >A whole paragraph, basically. > >My question is, how do you feel would be the best way to get >this long text data into my program to print on the page? >There are a number of ways I could do it, including puting >it in a file, then opening it and reading it a line at a >time into a variable and printing it out. Or I could do a >Compile time array and stick it on the bottom of my program. > ... Jim, unless you're absolutely positive you'll never want to to change the text, put it in a file, and just read it line by line. If you use an array, you have to worry about the exact number of lines (too many, and you get an error; too few, and you have to make sure you don't print a blank line). I'm not sure what the folks suggesting named constants or EVAL had in mind, but it seems to me that if you code the text as a single long string, you would have to write extra code to re-separate it into lines. >There is another type of array, I think, where I could >create the file and then load the array with the >information at run time from the file, though >I've never done that before. > ... What you're referring to here is called a pre-run array. These are ok for reading things like messages or month-names where the number of elements is well-defined, but for text that has a varying number of lines, they're awkward. Barbara Morris +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.