× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: VARLEN field... what good are they?
  • From: "Stone, Brad V (TC)" <bvstone@xxxxxxxxxxxxxx>
  • Date: Mon, 17 May 1999 11:01:04 -0500

Actually, Buck, I think you have it backwards.  The max size goes in the
field size and the minimum size goes in the first parm of the VARLEN
keyword.

So, in my case, I had a field that was max of 31000 bytes, and wanted to
specify at least 64 bytes.  So I specified...

 A            MHDATA     31000          VARLEN(64) TEXT('Message Data') 

This says min of 64 bytes, max of 31000.  When updating the field in an RPG
program, I had to do the following.

 D                 DS                      
 D MHDATA                  1  31002        
 D  MHDATALen              1      2B 0     
 D  MHDATAText             3  31002        
  *                                        

When I filled the field I had to say
C               eval    MHDATALen = %trim(%len(TEXT))
C               eval    MHDATAText = TEXT

Only then did it seem to not allocate all the needed space.  

The problem I was having before was that I changed the PF and then did a
copy file and I expected it to know my field sizes.  Well, it didn't and
assumed they were all 31000.

Seems cumbersome, but in this case it might be worth the space saved since
the max size is so large.


Bradley V. Stone
Taylor Corporation - OASIS Programmer/Analyst   
bvstone@taylorcorp.com


> -----Original Message-----
> From: Buck Calabro [SMTP:mcalabro@commsoft.net]
> Sent: Monday, May 17, 1999 9:35 AM
> To:   'MIDRANGE-L@midrange.com'
> Subject:      RE: VARLEN field... what good are they?
> 
> Brad, 
>   For your "length" in the DDS, give a value that covers the needs for
> most
> of your records (i.e. the minimum size).  The DDS manual refers to this as
> the fixed size.  This amount is allocated for every record.  Any overflow
> is stored in the variable length portion of the file.  An example may
> clarify:
> Customer master file, name field.  80% of the customers have names that
> fit
> into 25 columns, so you specify your size as 25.  "John Smith" will fit
> into the fixed length portion (no overflow).  "HRH Prince Charles Philip
> Arthur George" will store "HRH Prince Charles Philip" in the first 25
> columns (the fixed portion,) and " Arthur George" in the overflow area
> (the
> variable portion.)
> 
> The tradeoff is that is takes more time/effort to get/put information in
> the variable area.  That's why you don't simply use a minimum size of 1
> column.  In theory, it will be faster to read the record containing "John
> Smith" than the one containing "HRH Prince Charles..."  That's the reason
> for trying to get as many of your records to fit into the fixed area as
> practicable.
> 
> Buck Calabro
> Billing Concepts, Albany NY
> > -----Original Message-----
> > From:       Stone, Brad V (TC) 
> > Sent:       Monday, May 17, 1999 9:16 AM
> > To: 'MIDRANGE-L@midrange.com'
> > Subject:    RE: VARLEN field... what good are they?
> > 
> > Simon,
> > 
> > Could you give me an example of how I am supposed to code this in the
> > DDS?
> > I used the following:
> > 
> > A character field with a max length of 31000 bytes.  Minimum length of
> > 256
> > bytes.
> > 
> > Everything I tried either truncated the data or made a fixed length of
> > 31000.  
> > 
> > From what I understood is that the max length goes in the field length
> > paramenter.  Then, you specify on the VARLEN keyword what the minimum
> > length
> > is.  This didn't work for me and my file grew in size.
> > 
> +---
> | 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
> +---
+---
| 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 thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.