|
All you have to do with the array is make it arbitrarily large (enough to hold the text any way) and mark the end with a delimiter like '//end' or something equally creative. Once you start thinking in terms of control codes, it's like Bank Street Writer or Text 38 all over again--possibilities are limitless.<G> Condition the loop on finding the end marker. It does involve incrementing the array index manually and watching for overflow, though. Just having gone through a round of sending out batches of e-mail with the text in a file, I can see some advantages to the array. You can edit the text and get AS/400 WYSIWYG. 'Course, if you put the text in a source member, you can actually edit it with Text 38.<g> Again, it's a matter of taste, and whether the text is likely to change. -----Original Message----- From: bmorris@ca.ibm.com [mailto:bmorris@ca.ibm.com] Sent: Tuesday, June 20, 2000 4:02 PM To: RPG400-L@midrange.com Subject: Re: Text on report >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 +--- +--- | 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.