473,414 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

A97 variable length string declaration - how to do?

MLH
I'm working with lots of long strings now, it seems.
I have to import them & parse them constantly. The
A97 memo field type supports only 32768 chars.

What happens when this is processed...
Dim MyString As String
Am I getting VLS declaration or a FLS declaration?
Can I control which I get somehow?

I have done some homework, but I don't understand
my findings. Here's what I read in HELP...

There are two kinds of strings: variable-length and fixed-length
strings.

· A variable-length string can contain up to approximately 2
billion (2^31) characters.
· A fixed-length string can contain 1 to approximately 64K
(2^16) characters.

But it is not at all clear to me how to declare a variable-length
string VS a fixed-length string.
Nov 13 '05 #1
5 11717
MLH
Testing, it seems that the Dim statement creates a var that will hold
millions of characters. Its not obvious whether Dim MyString As String
differentiates between variable-length strings or fixed-length strings
at the moment of declaring the var.

What is obvious is that the Dim statement creates a string var that
can be assigned string values of any length up to the maximum
handled by variable-length string variables (around 2 billion chars).

I still don't know if A97 allows programmer to specify the string
var type as fixed or variable length?
Nov 13 '05 #2
In article <ue********************************@4ax.com>, MLH
<CR**@NorthState.net> Tue, 6 Sep 2005 11:52:54 writes
Testing, it seems that the Dim statement creates a var that will hold
millions of characters. Its not obvious whether Dim MyString As String
differentiates between variable-length strings or fixed-length strings
at the moment of declaring the var.

What is obvious is that the Dim statement creates a string var that
can be assigned string values of any length up to the maximum
handled by variable-length string variables (around 2 billion chars).

I still don't know if A97 allows programmer to specify the string
var type as fixed or variable length?


Something like (I think)

Dim S As String * 100

I assume the reason why a fixed length string is limited to 64K is that
the length in the Dim statement is implemented as an Integer.
--
Les Desser
(The Reply-to address IS valid)
Nov 13 '05 #3
You can declare a fixed length as:

Dim s As String * 20

However, with modern systems, I can think of NO reason to use fixed length
strings

(about the ONLY exception I can think of is for custom export routines, and
even that is stretching it)

Those fixed length strings are really only there for compatibility with VERY
VERY old BASIC code.

Further, why use a fixed length one? They do NOT run faster, they do NOT
save memory, and really don't do anything for you except let old COBOL
programmers, and few others from 20 years ago work with fixed length string
variables, of which we now don't care about, and don't need.
What happens when this is processed...
Dim MyString As String
Am I getting VLS declaration or a FLS declaration?
You are getting a variable length one.

Can I control which I get somehow?


You can, but do you really need to?

There is a good number of string functions that you can use to pad, or add
spaces.

I mean, just make a handy global function to pad strings. You can use:

Public Function MyPad(s As String, intSize As Integer) As String

MyPad = Format(s, "!" & String(intSize, "@"))

End Function
Now, anywhere in code, you can go:

mypad("abc",20)

The above expression would return the string of "abc", but padded to 20
chars long

So, even for a custom export routine, I don't see the need to declare fixed
length strings.

For input processing, I see even LESS need for fixed length strings.

Perhaps you might expand on why, or what the reasons here are for needing
fixed length strings, but I am at a loss here as why you need a fixed length
variable?

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal
Nov 13 '05 #4
MLH
Thx to you both. I agree. I don't see any
real need to burden myself dealing with
fixed length strings.

My real concern was whether or not I had
to do anything special to ensure I was dim'ing
string vars correctly (to handle VLS's. Thx!
Nov 13 '05 #5
"MLH" <CR**@NorthState.net> wrote in message
news:ru********************************@4ax.com...
Thx to you both. I agree. I don't see any
real need to burden myself dealing with
fixed length strings.

My real concern was whether or not I had
to do anything special to ensure I was dim'ing
string vars correctly (to handle VLS's. Thx!


On a lot of systems, fixed length strings run a LOT faster! (many times in
fact!!). However, VB or in our case VBA this is NOT the case.

So, your asking about how to use fixed length strings is very often a fair
question. It is a question that I took serous, despite it not having any
bearing in ms-access. So, often as a developer you will want to know if
fixed length variables are available, as they often can run MANY times
faster then VLS.

For some reason, in VB, or VBA, fixed length strings don't seem to change
performance at all, and in fact I seen them slow things down. So, I am
actually of the beliefs that those fixed length strings are "faked" by
ms-access in some fashion, and only put in for compatibility of old basic
code....
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
http://www.members.shaw.ca/AlbertKallal
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: User | last post by:
Hi, This is very basic, It may be a repost, if so I'm sorry. The problem is that this declaration : Private strMyArray(100) As String will create an array of string with a length of 101,...
7
by: YGeek | last post by:
Is there any difference between declaring a variable at the top of a method versus in the code of the method? Is there a performance impact for either choice? What about if the method will return...
2
by: Thomas Matthews | last post by:
Hi, I'm getting linking errors when I declare a variable in the global scope, but not inside a function. The declarations are the same (only the names have been changed...). class Book {...
3
by: Grant Wagner | last post by:
Given the following working code: function attributes() { var attr1 = arguments || '_'; var attr2 = arguments || '_'; return ( function (el1, el2) { var value1 = el1 + el1; var value2 = el2...
4
by: MLH | last post by:
I have a module named Declarations. In it, there is a line that reads: Global MySQL As String I decided to dimension it as a global variable after I was already deep into development. I got...
37
by: Joergen Bech | last post by:
(Slightly religious question): Suppose I have the following class: ---snip--- Public Class MyClass Private _MyVariable As Integer Public Property MyVariable() As Integer Get
22
by: Nathan Laff | last post by:
so, myself and the other developers i work with were looking at the v3.0 specifications. extensions look great, buy what is the point of implicit variables with the 'var' type? before you bash...
18
by: Pedro Pinto | last post by:
Hi there once more........ Instead of showing all the code my problem is simple. I've tried to create this function: char temp(char *string){ alterString(string); return string;
37
by: Erwin Lindemann | last post by:
If a VLA appears within a loop body, it seems the behavior is different with two different compilers I tried. I looked at the standard text, but couldn't find a definite answer there either. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.