|
So I set up a test with 2 fields and then do a DSPFFD and here is what I get: Number of fields . . . . . . . . . . . . . : 2 Record length . . . . . . . . . . . . . . . : 103 Field Level Information Data Field Buffer Buffer Field Column Field Type Length Length Position Usage Heading FLD1 CHAR 100 102 1 Both FLD1 Variable length field -- Allocated length : 30 Coded Character Set Identifier . . . . . : 37 FLD2 CHAR 1 1 103 Both FLD2 Coded Character Set Identifier . . . . . : 37 Bottom It looks to me like it is actually taking up more space than if I just left FLD1 at 100 without the varlen. What am I missing? -----Original Message----- From: Westdorp, Tom [SMTP:tom.westdorp@stationcasinos.com] Sent: Monday, July 17, 2000 2:52 PM To: MIDRANGE-L@midrange.com Subject: RE: Why use variable length fields? They don't have to be defined at their maximum length you define the allocated length and the maximum length for example: ----------------- The following copied from OS/400 DDS Reference v4r4 ----------- Use this field-level keyword to define this field as a variable-length field. Variable-length fields are useful for improving storage when the data for the field typically fits within a certain length, but can occasionally be longer. Specify the maximum length of the field in positions 30 to 34. You can specify the allocated length (or typical length) in the parameter. FIELD1 100A VARLEN(30) The allocated-length parameter is optional. Use it to specify the number of bytes allocated for the field in the fixed portion of the file. If you do not specify the allocated-length parameter, the data for this field is stored in the variable length portion of the file. Valid values for the allocated-length parameter are 1 to the maximum length of the field specified in positions 30 to 34. The VARLEN keyword is valid only on character fields. When you specify the VARLEN keyword, the maximum length you can specify in positions 30 to 34 is 32 740 (32 739 if the field allows the null value). ---------------------------------------------------------------------------- -------------------- +--- | This is the Midrange System Mailing List! | To submit a new message, send your mail to MIDRANGE-L@midrange.com. | To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com. | To unsubscribe from this list send email to MIDRANGE-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.