About [FIND CURRENT]

slh

Member
Hi guys,

May I check, in a single file can I exist different line of find current...?

I place Find Current at the different Trigger of the *.File, but it seems only the first one was trigger.

I trace down to debug it line by line, it just doesnt capture the Find Current inv-det exclusive-lock no-wait no-error?

Or do I need to release the first one since most of my Find Current accessing same table?
Eg:
Find Current inv-det Exclusive-Lock No-Error No-Wait.
If Find inv-det Then Do:

End.
Release inv-det. ?

Regards
 

slh

Member
Hi All,

To add on, I did a procedure editor to manually select by inv-det.inv-no & inv-det.code, it was able to return the results smoothly.

Wonder what did I miss/ did wrongly?

Regards
 

RealHeavyDude

Well-Known Member
FIND CURRENT will always re-fetch the current row in the buffer. AFAIK it uses the ROWID for that. If FIND CURRENT retrieves a different row than you expect then I would say the row that is in the buffer is not what you think it is. Maybe some other logic using the same buffer (most likely the default buffer associated with the database table) has fetched a different row in the meantime.

You should be very careful when using the default buffer associated with the database table which might be shared by a lot of logic, amongst others, for that reason.

Heavy Regards, RealHeavyDude.
 

slh

Member
FIND CURRENT will always re-fetch the current row in the buffer. AFAIK it uses the ROWID for that. If FIND CURRENT retrieves a different row than you expect then I would say the row that is in the buffer is not what you think it is. Maybe some other logic using the same buffer (most likely the default buffer associated with the database table) has fetched a different row in the meantime.

You should be very careful when using the default buffer associated with the database table which might be shared by a lot of logic, amongst others, for that reason.

Heavy Regards, RealHeavyDude.

Hi Dude,

Thanks for the response, I had long suspect other logic might be hogging to it. As such I searched through all Find Current Keywords in the code and explicitly Release inv-det at the end of each statement.

However, it just that this time round inv-det was'nt working at all depicted from the display statement I did right after the Find Current statement.

Regards.
 

slh

Member
Hi Dude,

To add on, I did an exclusive lock using FIND to replace FIND Current, manage to overcome the issue. HOWEVER, there is this funny behaviour. Progress is able to retrieve the value out (It is confirmed by doing a message display RIGHT after the find statement). But when I tried to do an update, it prompt me with a message inv-det record not on file. (138)

Regards
 

RealHeavyDude

Well-Known Member
In one of the previous post you talked about using the RELEASE statement. That's most likely responsible for the error message you get.

You should be aware that using RELEASE is bad practice. The root of your problem is inappropriate buffer scope and you try to work on the symptoms using RELEASE and other fancy stuff. Furthermore, the RELEASE statement might not actually behave is you think it is.

You should make yourself familiar with what a buffer really is, what happens when you use the default buffer associated with the database table (same name) and how to use named buffers as. Plus you should make yourself familiar with buffer scope. Otherwise you will spend a lot of time on symptoms instead of solving the underlying issue.

A good starting point is the programming handbook that comes as part of the documentation.


Heavy Regards, RealHeavyDude.
 

tamhas

ProgressTalk.com Sponsor
Start with COMPILE LIST to find out if your buffer scopes and transaction blocks are where you think they are.
 

rzr

Member
Syntax for LISTING option with COMPILE statement is:

COMPILE "myprogram.p" LISTING "myprogram.lst".


Produces a compilation listing that includes:
  • The name of the file containing the procedure or class you compile
  • The date and time at the start of the compilation
  • The number of each line in the procedure or class file
  • The block number where each statement belongs
  • The complete text of all include files (except encrypted include files) and the names of any subprocedures and user‑defined functions
Also in the second part of the listing file search for word "Buffers:". It will tell you to which block that buffer is scoped.
 

slh

Member
Syntax for LISTING option with COMPILE statement is:

COMPILE "myprogram.p" LISTING "myprogram.lst".



Produces a compilation listing that includes:
  • The name of the file containing the procedure or class you compile
  • The date and time at the start of the compilation
  • The number of each line in the procedure or class file
  • The block number where each statement belongs
  • The complete text of all include files (except encrypted include files) and the names of any subprocedures and user‑defined functions
Also in the second part of the listing file search for word "Buffers:". It will tell you to which block that buffer is scoped.



Hi rzr,

Thanks, sorry but how do I generate this? In procedure editor?

Regards
 

slh

Member
Syntax for LISTING option with COMPILE statement is:

COMPILE "myprogram.p" LISTING "myprogram.lst".



Produces a compilation listing that includes:
  • The name of the file containing the procedure or class you compile
  • The date and time at the start of the compilation
  • The number of each line in the procedure or class file
  • The block number where each statement belongs
  • The complete text of all include files (except encrypted include files) and the names of any subprocedures and user‑defined functions
Also in the second part of the listing file search for word "Buffers:". It will tell you to which block that buffer is scoped.

Hi rzr,

How do I locate this files (eg: d-invoice2.lst)?

Regards
 

rzr

Member
in the complie & listing options. .. you can give the full path name to tell progress where you want to save the listing file.
if you don't do that, progress will create the file in the temp directory. find the temp-dir using below ..and find your .lst in that path

MESSAGE SESSION:TEMP-DIR
VIEW-AS ALERT-BOX INFO BUTTONS OK.
 

slh

Member
in the complie & listing options. .. you can give the full path name to tell progress where you want to save the listing file.
if you don't do that, progress will create the file in the temp directory. find the temp-dir using below ..and find your .lst in that path

MESSAGE SESSION:TEMP-DIR
VIEW-AS ALERT-BOX INFO BUTTONS OK.

Hi rzr,

Thanks, I manage to get it run (F2 in procedure editor) not sure is it right way, in my procedure editor I did a COMPILE myfile.w Listing myfile.lst.

Anyhow, the directory was in c:/Progress/Work.

Regards
 

rzr

Member
okay... you can also alternatively use the "Application Compiler" menu option to compile & save your listing files to a specific directory.
Open Progress Desktop. Go to Tools - Application Compiler to access this tool. I think it runs the program "_comp.p" simliar to "_dict.p" for data dictionary. I now don't recall where _comp.p would be.. maybe in C:\Progress\OpenEdge\Src ....
 
Top