|
Martin, One solution would be to write a database wrapper/shell/server, whatever you want to call it for each database file. Then provide a generic procedure setNull(fieldname). That module would also support various get record procedures etc. I usually write an abstraction layer (Mediator) that calls file specific module routines, but you don't have to carry it that far. I think you will come to like this technique once you get past the initial challenges. I have done this several ways and find it is very powerful. Midrange Computing published an article about this technique a couple of years ago called Dynamic Data. I could send some code examples if it would help. David Morris >>> boldt@ca.ibm.com 03/13/02 08:04AM >>> Martin wrote: >I've just written a subprocedure which receives, by reference, one of a >series of null-capable database fields. After processing, if the field >contains no data, I want to set its null indicator on, by calling >%nullind() on it, so that when it is written to the database, it will >correctly be identified as null. However, I get a compilation error, >saying that the field is not null-capable. You've just encountered a limitation of null-capable fields. The "null" flag is an attribute of a database field only, and not really an attribute of an RPG variable. As a result, the null flag is not passed when passing a field as a parameter. The fundamental problem is that variables in RPG (unlike a couple of other languages) cannot be assigned a value of "null", or "no value". I've got no easy solution to this. For each null-capable field you want to pass as parameter to a procedure, you'll need to pass an extra indicator variable set to the value of the fields null flag, and then explicitly set the null flag on return from the procedure. Cheers! Hans Hans Boldt, ILE RPG Development, IBM Toronto Lab, boldt@ca.ibm.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.