Lotus Notes "NSD is running error"

Hi all,
I am working on Lotus Notes, i have a programe that takes data( in canonical form, no matter NSF file is working or corrupt) ,as input and write data using API in New Database.
Programe is working well on 90% documents in database.but in 10% i am suffering with errors in New Database  created by program mainly "the NSD is running" because it terminates lotus.
can you please suggest what is exactly the problem?
Thanks in advance
davinder101Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sjef BosmanGroupware ConsultantCommented:
As far as I can remember from your earlier questions, you tried to build a C or C++ application interfacing with Notes or Domino using two APIs at the same time, am I correct? At the time, you already got several errors in C and in the database, and instead of correcting the errors you settled for fixing up the database produced. And now Notes gives up, which seems quite logical to me, for an application that works on only 90% of the documents isn't a good and fully tested application at all. We also told you that your application needs to follow the programming rules exactly and I assume you didn't take that advice.

So, IMHO the problem is the developer of the application...

I'm afraid that there aren't many people here who can help you. There probably are some serious mistakes in your code, so you might need a C-API specialist who's willing to read through all of your code. Are you willing to post that code here? For example, do you have one or more working test-applications, that test the basics of your application, that you can share? The 7 lines you wrote above give very little information, so unless you tell a lot more about your application, I'm afraid you won't get a lot of response.

Sorry...
0
davinder101Author Commented:
Hello,yes you are right,i am same person that talked u earlier.

i am telling u that my application takes Data(canonical or hex values) as input,i have my parsing technique(i parse data (hex data) for every document and than for every item in the document ), have this data in buffer and pass buffer to NSFItemAppend(...)
because i donot want to login to database and NSFItemAppend(...) is good in this case i am going right,but some times NSFItemAppend(...) shows error when i call it error is "Document has invalid structure" and in NSD case it Appends the Data to Database but in new database when open a mail it give "NSD is running error" even when i have a working database,i m not able to recover 100% documents by this way.
if it is NSFItemAppend(...) function problem than can u tell me any other way to write data in new database.
and in the mail that cause NSD error the item that is responsible is "BODY" if i write that mail without item BODY than it has no error.
0
CRAKCommented:
Sorry to interrupt, but Sjef is probably right!
If your code fails in 10% of the documents, you should find out why before you can work on a workaround. That would mean accessing the database "the right way". You wrote that you didn't (want to) login. Haven't to questioned what would happen if you'd encounter a read protected document? Or an encrypted field? Can you tell the difference between normal docs and profile docs? Is there a response structure? Or document notes and design elements notes?
Think of recreating a document containing a richtext field with attachments. Assume that the rt field is called "Body". The attachments will show (Notes client) in "Body", but are actually stored in one or more "$Body" fields. Copying both items (as datastream or the "official" way) may not always ensure that this expected structure remains in tact!
In short: you need to find out more abount these 10% and fix, rather than ignore, errors!
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

davinder101Author Commented:
Actually what i am working only on documents(mail,todo journal,calendar,contacts) not on design elements (forms,pages,views etc).i know 0x0001 represents a document.and 0x000004,0x0008 etc are used for forms ,view etc.
so when i parse the database i always check for 0x0001 and than parse the note.
and write this to a new database that i create using api.

and flow of PROGRAME is:-

1.CreateDatabase.

2.Db.CreateDocument(&doc);
3. calling NSFItemAppend(....) for every iten in doc
4.doc.Save();
5.doc.Close();

0
Sjef BosmanGroupware ConsultantCommented:
And what do you want from us now? What happens is simply that your theory is right but your program is wrong. You should thoroughly test it again and again. It's a fact that there are thousands of C-API applications written that run without problems. So, if there is a problem when you run your application, you may safely assume it is NOT caused by Notes. You probably know that C is a dangerous language: it's working directly on the hardware, meaning there is no virtual machine that catches array errors and the like. If you use invalid addresses or you ruin the stack, things will go wrong big time.

Also, it could even be a semantical error in your code, e.g. "=" instead of "==" ...

My one and only advice:

 T E S T !!!
0
CRAKCommented:
Have you recorded UNID's somewhere, to be able to identify the docs that trigger errors and find out why/where issues occur?
For the rest of this matter: I don't understand why anyone would want to use an API to create a database, but not to collect documents, or copy entire documents.
0
Sjef BosmanGroupware ConsultantCommented:
Davinder, can you get the links to your previous questions and post them, so others can read the story from the start?
0
davinder101Author Commented:
yes ,i know the causes of these error this is because when i am giving data to NSFItemAppend(..)(from orignal database to new database) ,it changes some bytes in data that is the problem.

ok,can you tell me any other way to write data for every item in lotus or any function that can be used to write data (hex values) as NSFItemAppend(...) , can solve my problem.
Thanks
0
Sjef BosmanGroupware ConsultantCommented:
> ... it changes some bytes in data, that is the problem.
I'm sorry I have to say once again that is not the problem. It is only a manifestation of the problem. "It" doesn't change bytes for no good reason, it is not "Its" fault. It is your application that doesn't follow the rules specified in the documentation. I think it's very likely that memory is overwritten somewhere, that you didn't allocate enough or that you use insufficient stack space.

It's like your bike has a flat tyre. What you feel is a bumpy road, and you are proposing to change the saddle or sweep the road...

 T E S T  ! ! !
0
davinder101Author Commented:
do you know any method to write data in nsf database from one database without login to file.because in case of corruption i can't use API.but i want my program to recover all data that is in a file no matter file working or corrupt.

NSFItemAppend(...) is able to do this with lots of problems like "document has invalid structure" error.and some errors in database created.
do you have any other alternative of NSFItemAppend(...) ?
0
Sjef BosmanGroupware ConsultantCommented:
No.
0
CRAKCommented:
There are so many questions around on how to access an nsf file without a notes client, and I don't think that I've ever seen a solution.
With a Notes client however.... but you'd need to login!
...but I'm not a C-developer!
0
davinder101Author Commented:
Can you tell me, how should i use the API ?
i want to copy all documents from one database to second.
what should be the flow from the start to end?
0
Sjef BosmanGroupware ConsultantCommented:
0
davinder101Author Commented:
LNNote::CreateItem(). function is notes c++ API can work for me only problem is when item "Body" with more than 65K need to write using this i need tom call  CreateItem() multiple times but this is giving error message "item already exist" for second time.
can you tell how can i write Body with more than 65K length using CreateItem().
this can be very helpful.

Thanks
0
Sjef BosmanGroupware ConsultantCommented:
Read this carefully:
http://notes2dekiwikisample.wik.is/Lotus_Cpp_API/01_Reference_Guide/LNNote_Class/LNNote::CreateItem

You should use CreateItem only once, then you use the proper method to append rich text.

A good manual, still valid probably:
http://www.redbooks.ibm.com/redbooks/pdfs/sg244876.pdf

See page 554 (562 in the PDF Reader)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
davinder101Author Commented:
According to the link item "Body" is madeup of several structures and we have all structures in API. can i use  ODSReadMemory(), and ODSWriteMemory() write structures one by one and how please explain.
0
Sjef BosmanGroupware ConsultantCommented:
What you're asking now is too deep and detailed in the use of C++ and the API, I have no knowledge myself in this area.

So sorry, but if nobody else jumps in here, you're pretty much on your own...
0
davinder101Author Commented:
thanks for your help.
0
davinder101Author Commented:
i am working on it.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Lotus IBM

From novice to tech pro — start learning today.