|
On Mon, 10 Mar 2003, Joel Fritz wrote: > > The from value comes from a data structure defined in the procedure. It > looks like the O specs want global variables. That makes sense. Seems like > overkill to write a print file. I can also define a global variable used > only in the file update procedure. That doesn't really excite me either. > > Yes, files in RPG are global. You need to use global variables if you want to write data to them. Here are a few thoughts: 1) You could just have *one* global variable for printer output. A string defined as 132A (for example) would work nicely. Then populate it from your data structure with statements like: eval printme = *blanks eval %subst(printme: 1) = %editc(ds_value1: 'L') eval %subst(printme: 10) = %editc(ds_value2: 'M') This is *almost* like having o-specs in your subprocedure. Of course, you'll want to do an EXCEPT once all of the fields have been populated. 2) use a service program or module that's just for printing. Since global variables are global to the *module (as opposed to the entire program) you are restricting the variables to just the one procedure. (This is awkward IMHO, but it's a thought) 3) use the ILE C routines to create files that *are* local to your subprocedure. (This is probably too much work and/or too much of a learning curve -- but I thought I'd throw it out there) 4) write the output to a stream file instead of a spooled file. Of course, then it doesn't print without you doing extra work, but sometimes this is useful, like if the user wants to just grab the file and open it in notepad or something, and then print it from there... I guess a lot depends on the application and/or why you don't want to use global variables.
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.