473,657 Members | 2,571 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Bad Length error - Very Urgent

9 New Member
Hi

When I'm trying to write data to a file from a custom variable(contai ns group of string items) it is giving me Runtime Error 59: bad record length.

Put #1, , ee_rec20 --this is the line which is giving the error

Kindly respond to this. I've to generate the file in an hour, please.

Regards,
Vinay
Feb 20 '07 #1
4 3300
Killer42
8,435 Recognized Expert Expert
Hi

When I'm trying to write data to a file from a custom variable(contai ns group of string items) it is giving me Runtime Error 59: bad record length.

Put #1, , ee_rec20 --this is the line which is giving the error

Kindly respond to this. I've to generate the file in an hour, please.
Sorry if it's too late now, but can you show us the definition of ee_rec20?
And how is the file opened - for Binary or Random? Posting the Open statement would probably help.
Feb 21 '07 #2
Killer42
8,435 Recognized Expert Expert
Also, have you read the doco on this error?

Bad record length (Error 59)

The length of a recordvariable in a Get or Put statement must be the length specified in its corresponding Open statement. This error has the following causes and solutions:
  • The record variable's length differs from the length specified in the corresponding Open statement.
    Make sure the sum of the sizes of fixed-lengthvariables in theuser-defined type defining the record variable's type is the same as the value stated in the Open statement's Len clause. In the following example, assume RecVar is a variable of the appropriate type. You can use the Len function to specify the length, as follows:
    Expand|Select|Wrap|Line Numbers
    1. Open MyFile As #1 Len = Len(RecVar)
  • The variable in a Put statement is (or includes) a variable-length string.
    Because a 2-byte descriptor is always added to a variable-length string placed in a random access file with Put, the variable-length string must be at least 2 characters shorter than the record length specified in the Len clause of the Open statement.

  • The variable in a Put statement is (or includes) a Variant.
    Like variable-length strings,Variant data types also require a 2-byte descriptor. Variants containing variable-length strings require a 4-byte descriptor. Therefore, for variable-length strings in a Variant, the string must be at least 4 bytes shorter than the record length specified in the Len clause.
Feb 21 '07 #3
Garimella
9 New Member
Hi Killer42,

Thank you very much for the help. I solved it yesterday itself. Yes it was because of the definition of length. It was declared as 600 characters whereas the final output has 619 characters. That's not the end of the story.. i've one more issue. Now few records are having lot of spaces inthe front because of which the file looks unorganized. can you please help me. it's looking like this.
Expand|Select|Wrap|Line Numbers
  1.                                    000034330000 ........................(this is having lot of spaces before...)
  2. 090090000 txtfior....
  3. 090090000 txtfior....
  4. 090090000 txtfior....
  5.                                    000034330000 ........................
Feb 21 '07 #4
Killer42
8,435 Recognized Expert Expert
Glad to hear you resolved the first problem.

As for the spaces, I think we'd need to see the code which wrote that data. Quick question, though - are you sure you don't just have those spaces in the variable that you're writing?
Feb 21 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
4140
by: XML newbie: Urgent pls help! | last post by:
I am using VB.Net. My program is to connect to a remote IPAddress. Once, it verifies the login information it should display the SessionID and enable some button . I appreciate your help and thanku in advance When I run the pgm , I get the error: Can't parse login information. Namespace Manager or XsltContext needed. This query has a prefix, variable or userdefined function. I have added the Try-catch in all my functions. In...
2
2673
by: Nalaka | last post by:
Hi, I get the following error, I thought at random intervals. Then I realized, that this happens around the time tha page outputCache is set to expire. So I disabled the page output cache and the problem went away. I put in the outputcache back and the problem is back. I am using forms authentication... and asp.net 2.0. Have you seen this problem before... any help is deeply appreciated.
4
6805
by: Jason Richmeier | last post by:
I am sure this has been asked at least once before but I could not find anything when searching. If I set the value of the ExitCode property to 1066 for a windows service, the text "A service specific error occured: 0." How do I (if it is possible) change the value of the zero to something custom (like a "look in the event log for further information" message)? Thank you,
1
2116
by: psantosh12 | last post by:
Hello Frnds Please need help to resolve error.......... it is very very urgent........ The error is Runtime Error Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of...
6
1994
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
Hi - I have 4 webservers in my webfarm. All Win2k3 web edition. Before yesterday, none of them were service packed. I have now applied SP2 to two of them, and I'm getting a very weird MSDTC error on them now. The error occurs when I attempt a series of SQL statements wrapped in a TransactionScope(). It's executing against a different server, so this is where it's elevated to a distributed transaction.
9
2072
by: Trapulo | last post by:
Hello, with ASP.NET 2.0 Ajax every unexpected error is managed client-side with a popup that reports the error to the user. In ASP.NET 3.5 this behavor has been changed: how can I have a similar behavor? I'd like that every exception raised from ASP.NET runtime during an asyncpostback is managed in client side with a popup that reports the error message. thanks
2
9858
by: selvamariappan | last post by:
Hi all , I am using encryption to encrypt the query string passed from one page to other. In works fine most of the time but occationally i get this error - The line that throws that exception is Dim cipherTextBytes As Byte()
2
4222
by: Steven Cheng | last post by:
Hi Gary, As for the setting you mentioned, it is used to custimze the received data size limitation of WCF binding(such as NetTcpBinding or HttpBinding). After you have definite a customized Binding setting, you can apply it to your WCF service via the "bindingConfiguration" attribute of each <endpoint> here is a simple WCF service configuration in web.config which demonstrate this:
7
16313
by: =?Utf-8?B?SmVycnkgQw==?= | last post by:
I am using this code to get groups for a user and getting a error (5) on the GetAuthorizationGroups() function . There are two domains. This function works on the local domain but does not work on the other domain. Other functions work on the other domain like get all the users and get all the groups and I can validate users on the other domain so I think I am communciating with the other domain OK just not with the...
0
8305
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8823
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8503
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6163
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4301
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1950
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1607
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.