|
Pete, It is easy to create a varying length field in either DDS or SQL. In DDS the field is defined as any other character field is defined and then add keyword VARLEN(nnn) where nnn is less than maximum length defined. VARLEN(nnn) defines the default length stored inline as a part of the PF. If the data length exceeds len(nnn) then a variable extension is created. For performance reasons you want to avoid that most of the time without wasting disk space. In RPG just remember to use VARFLD = %TRIMR(LongChar). Otherwise you end up with VARFLD padded with blanks. There certainly would be nothing wrong with using CREATE TABLE to accomplish the same result. I use both methods as the situation warrents without any problems. It is also easy to deal with these fields in RPG if that is an issue. I can see no reason to put this type of data into another library. Don Tully Tully Consulting LLC -----Original Message----- From: midrange-l-bounces@xxxxxxxxxxxx [mailto:midrange-l-bounces@xxxxxxxxxxxx]On Behalf Of Pete Helgren Sent: Thursday, January 27, 2005 12:46 PM To: 'Midrange Systems Technical Discussion' Subject: Variable length fields I need to store a varying amount of text data in a field in a currently non-existent table and I am pondering how best to approach creating it. I'll be using Java as the programming language (and, yes, David, I'll move this to the JAVA-400 forum if the details take us there). I have primarily worked with PF's and DDS on the iSeries and done a little bit of SQL (create collection, create table, alter table, etc). What data type would work best here? Looks like varchar would work. Would that recommendation change if you were using RPG to access the data? If my PF's are all stored in libraries, is it best in this case to only use the create table command to put it in a new collection, or could I put it in an existing library (or perhaps I cannot even do this...?) Any wisdom in approaching this would be appreciated. Thanks, Pete Helgren Value Added Software, Inc 801.581.1154 x202 -- This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/midrange-l or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.