Avoid concurrence when text_io.fopen

Hi, i open a file
     in_file := Text_IO.Fopen(filename, 'r');
only to read the data and do some inserts.
But I need to know nobody is opening the file, and show a message if it's happening. How?
If i do after the open:
     if Text_IO.is_open(in_file) then
     --message alert....
          end if;
it shows it always, because the file handler is of the file open... In fact, is_open is only the know if the file you've opened remains opened...
...but not for to know if it's already opened by somebody else (what I would want)
Thanks!

If the operating system (OS) tells you that the file is already opened for read-only, then you need to see how the OS informs you. If the OS does not inform you (most do not), then you won't know.
There are work arounds if the OS doesn't tell you. You can create an OS script that you use to open the file. When the script runs, it creates a text file indicating the file is open. Create another script to delete the text file when closing the file. Then your form checks to see if the text file exists before opening the file. If the text file exists, then you know the file was already opened.
Also, some OS will prevent opening a second file if the first file is opened for writing.

Similar Messages

  • URGENT : ORA 302000 when using TEXT_IO.fopen

    Hi,
    I get this error ORA 302000 when using TEXT_IO package, the code I use is
    new_file:=text_io.fopen('c:\text.txt','r')
    i don't have the description of this ORA 302000 , pls does anyone have it?

    Hi,
    I know it's been 2 years but it's still up to date for me.
    I tried the suggested piece of code to trace the error but it did not bring anything more
    EXCEPTION
    When Others then
    srw.Message( 2, 'EXCEPTION ' || SQLCODE || ' in common package. Can not open the file ');
    IF SQLCODE = -302000 then
    LOOP
    EXIT WHEN TOOL_ERR.NERRORS = 0;
    SRW.MESSAGE( 667, TO_CHAR(TOOL_ERR.CODE) || ': ' || TOOL_ERR.MESSAGE);
    TOOL_ERR.POP;
    END LOOP;
    END IF;
    srw.Message( 3, 'EXCEPTION ' || SQLCODE || ' in com package. Can not open the file ' || I_Desname || ' : ' || SQLERRM );
    Only Message 2 and 3 are displayed in the trace file
    Any other suggestion?
    Manu

  • TEXT_IO.FOPEN not working on web deployed app FORMS 6i

    Hi all
    I have coded parsing file by using TEXT_IO.GET_LINE but it seems that my file even can't be opened.
    declare
    file1 text_io.file_type;
    filename1 varchar(256);
    linebuf varchar2(100);
    begin
    file1 := TEXT_IO.FOPEN(:CSV.CSV_PATH, 'r');
    Text_IO.Get_Line(file1, linebuf);
    if linebuf!='blablablablabla' then msg('line is OK!');
    else msg('Line is wrong!');
    end if;
    TEXT_IO.FCLOSE(file1);
    end;
    On local machine when i enter into :CSV.CSV_PATH "C:\details.txt" the file gets loaded because it gets processing, I can see messages.
    When I upload form onto remote web-deployed app server, I enter into path "D:\details.txt" (I cannot write on C:, the files are the same) nothing happens. Does it mean text_io won't work on Fomrs6i web-deployed? How can I investigate this issue.
    Thanks in advance
    Tome

    With Forms Server deployments. TEXT_IO writes the file on the Forms server not the local PC as it did in client-server mode.
    Here are some workarounds
    1) Download the WEBUTIL add-on from Oracle and use its TEXT_IO package to write to the local file.
    WebUtil is an essential add-on loaded with goodies such as a file browse dialog for local files. Its easy to use and is designed to be compatible with other oracle routines like TEXT_IO.
    Kudos to Duncan Mills at Oracle for this top add-on - dont leave home without it.
    www.oracle.com/technology/products/forms/htdocs/webutil/webutil.htm2) Use the original TEXT_IO (as you are now) to write to a file on the Forms Sever , then display it in a browser window using WEB.SHOW_DOCUMENT
    3) I remember seeing some some old Java scripts on OTN to write to local PC.
    MY APOLOGIES for #3. Most forum posts can be solved with that little gem of an answer. "My sink is blocked" ... "yeah I saw some java code to fix that"

  • TEXT_IO.FOPEN how to pick file without specifying the full directory path

    Hi,
    I am using Oracle application server 10gR2 on Linux with forms 10g application. I am building the DEV/TEST/UAT environment on same Linux machine with one OAS.
    I am using TEXT_IO.FOPEN ('/home/oracle/check.txt','r') to read a server side file and it is working fine.
    Now I want to pick this file dynamically i.e. without specifying the full path. I am using TEXT_IO.FOPEN ('check.txt','r') and I copied file in forms_path directory in linux and even in $path directory in linux but none of them are working.
    Pls help me sort out this problem.
    Thanks in advance

    Hi,
    I have to read files in my app directory using TEXT_IO how is that possible?? I cannot set workingDirectory as my Oracle home is in a different location and as has been mentioned by others when I run the form on web it cannot seem to find the file in the default forms directory where all the .fmx file
    Is there any other file setting that needs to be done??
    Please help
    Thanks & Regards
    Mangesh Deshpande

  • Text_IO.Fopen

    Hello,
    I would like to ask, in which directory, does text_io.fopen searches to find the file for opening?
    for example if I say in a fmb/pll file in a program unit,
    in_file := Text_IO.Fopen(salary.txt, 'r');
    without specifing the whole directory path ('c:\salary.txt')
    Where will Oracle search to find the file salary.txt?
    On C:\?
    On D:\?
    On a network drive?
    On the directory where my fmb/pll file exists...
    Is it possible to tell Oracle to search by the registry?
    I mean if my FORMS60_PATH is
    C:\ERP;H:\Erp\Forms;H:\Erp\GL_Forms;H:\ERP\LIBS;
    to search first on C:\ERP, if the file does not exist, then in H:\Erp\Forms
    then in H:\Erp\GL_Forms etc....
    Thank you very much.

    Hello,
    Test to write a file without directory, then search it on the disk.
    Francois

  • Possible solution to avoid deadlock when two inserts happen on same table from two different machines.

    Possible solution to avoid deadlock when two inserts happen on same table from two different machines.
    Below are the details from deadlock trace.
    Deadlock encountered .... Printing deadlock information
    Wait-for graph
    NULL
    Node:1
    KEY: 8:72057594811318272 (ffffffffffff) CleanCnt:3 Mode:RangeS-S Flags: 0x1
    Grant List 2:
    Owner:0x00000013F494A980 Mode: RangeS-S Flg:0x40 Ref:0 Life:02000000 SPID:376 ECID:0 XactLockInfo: 0x000000055014F400
    SPID: 376 ECID: 0 Statement Type: INSERT Line #: 70
    Input Buf: RPC Event: Proc [Database Id = 8 Object Id = 89923542]
    Requested by:
    ResType:LockOwner Stype:'OR'Xdes:0x0000002AA53383B0 Mode: RangeI-N SPID:238 BatchID:0 ECID:0 TaskProxy:(0x00000027669B4538) Value:0x10d8d500 Cost:(0/38828)
    NULL
    Node:2
    KEY: 8:72057594811318272 (ffffffffffff) CleanCnt:3 Mode:RangeS-S Flags: 0x1
    Grant List 2:
    Owner:0x0000000B3486A780 Mode: RangeS-S Flg:0x40 Ref:0 Life:02000000 SPID:238 ECID:0 XactLockInfo: 0x0000002AA53383F0
    SPID: 238 ECID: 0 Statement Type: INSERT Line #: 70
    Input Buf: RPC Event: Proc [Database Id = 8 Object Id = 89923542]
    Requested by:
    ResType:LockOwner Stype:'OR'Xdes:0x000000055014F3C0 Mode: RangeI-N SPID:376 BatchID:0 ECID:0 TaskProxy:(0x000000080426E538) Value:0x30614e80 Cost:(0/41748)
    NULL
    Victim Resource Owner:
    ResType:LockOwner Stype:'OR'Xdes:0x0000002AA53383B0 Mode: RangeI-N SPID:238 BatchID:0 ECID:0 TaskProxy:(0x00000027669B4538) Value:0x10d8d500 Cost:(0/38828)
    deadlock-list
    deadlock victim=process5daddc8
    process-list
    process id=process5daddc8 taskpriority=0 logused=38828 waitresource=KEY: 8:72057594811318272 (ffffffffffff) waittime=2444 ownerId=2994026815 transactionname=user_transaction lasttranstarted=2014-07-25T12:46:57.347 XDES=0x2aa53383b0 lockMode=RangeI-N schedulerid=43 kpid=14156 status=suspended spid=238 sbid=0 ecid=0 priority=0 trancount=2 lastbatchstarted=2014-07-25T12:46:57.463 lastbatchcompleted=2014-07-25T12:46:57.463 clientapp=pa hostname=pa02 hostpid=1596 loginname=myuser isolationlevel=serializable (4) xactid=2994026815 currentdb=8 lockTimeout=4294967295 clientoption1=671088672 clientoption2=128056
    executionStack
    frame procname=mydb.dbo.SaveBill line=70 stmtstart=6148 stmtend=8060 sqlhandle=0x03000800d61f5c056bd3860170a300000100000000000000
    INSERT INTO [dbo].[Prod1] .....
    inputbuf
    Proc [Database Id = 8 Object Id = 89923542]
    process id=process5d84988 taskpriority=0 logused=41748 waitresource=KEY: 8:72057594811318272 (ffffffffffff) waittime=2444 ownerId=2994024748 transactionname=user_transaction lasttranstarted=2014-07-25T12:46:57.320 XDES=0x55014f3c0 lockMode=RangeI-N schedulerid=39 kpid=14292 status=suspended spid=376 sbid=0 ecid=0 priority=0 trancount=2 lastbatchstarted=2014-07-25T12:46:57.440 lastbatchcompleted=2014-07-25T12:46:57.440 clientapp=pa hostname=pa01 hostpid=1548 loginname=myuser isolationlevel=serializable (4) xactid=2994024748 currentdb=8 lockTimeout=4294967295 clientoption1=671088672 clientoption2=128056
    executionStack
    frame procname=pa.dbo.SaveBill line=70 stmtstart=6148 stmtend=8060 sqlhandle=0x03000800d61f5c056bd3860170a300000100000000000000
    INSERT INTO [dbo].[Prod1]....
    inputbuf
    Proc [Database Id = 8 Object Id = 89923542]
    resource-list
    keylock hobtid=72057594811318272 dbid=8 objectname=pa.dbo.prod1 indexname=PK_a id=lock1608ee1380 mode=RangeS-S associatedObjectId=72057594811318272
    owner-list
    owner id=process5d84988 mode=RangeS-S
    waiter-list
    waiter id=process5daddc8 mode=RangeI-N requestType=convert
    keylock hobtid=72057594811318272 dbid=8 objectname=pa.dbo.prod1 indexname=PK_a id=lock1608ee1380 mode=RangeS-S associatedObjectId=72057594811318272
    owner-list
    owner id=process5daddc8 mode=RangeS-S
    waiter-list
    waiter id=process5d84988 mode=RangeI-N requestType=convert

    Don't know. Perhaps these can help. I scanned the second link but didn't see much about Ending Deadlocks. I'd say the Fourth link probably has better information than the first three links. But maybe read them all just in case the Fourth is missing something
    one of the first three have.
    Deadlocking
    Detecting and Ending Deadlocks
    Minimizing Deadlocks
    Handling Deadlocks in SQL Server
    Google search for "SQL Deadlock"
    La vida loca

  • Settings on iPhone to avoid charges when travelling question about carrier

    Hi
    Want to check setting  on iPhone to avoid charges when travelling on iPhone 5 .
    I have googled but still wanted to check as I only want to use wifi and with air plane mode I actually recovered a text message which led me to think I was not fully disabled for travelling and avoiding cost so I make the following additional changes but wanted to ensure nothing was missing.
    1.  Enable airplane mode
    2.  Then Settings - cellular data - off
    I noticed that under Settings that Carrier is still set as Automatic and on.  Should this be off?
    Please clarify, thank you

    Based from my carriers for my country, to be able to connect to an overseas carrier (to receive calls or sms from your home country) it can be enabled by contacting the carriers; with or without a charge.
    Then, the carrier can be set to automatic/ON (connects to an overseas carrier automatically that is prefered by your home country's carrier) or OFF (choose the respective carriers that you prefer).
    It is still best to switch off the cellular data when you're overseas.
    Just a precaution:
    Go Settings > Mobile/Cellular > Data Roaming > OFF
    Data Roaming: Uses mobile data when you're connected to an overseas carrier (heavy charges apply).
    Hope it helps.

  • What is the best way to avoid latency when using the io plug in?

    What is the best way to avoid latency when using the io plug in?

    Hi colin a.
    Welcome to the Support Communities!
    The article below may be able to help you with this.  Click on the link to see more details and screenshots. 
    Logic: About I/O buffer size and monitoring latency
    http://support.apple.com/kb/ht1314
    Cheers,
    - Judy

  • [svn] 4376: Partial fix to allow Array child of IVisualElementContainer to leverage includeIn (to avoid regression when

    Revision: 4376
    Author: [email protected]
    Date: 2008-12-22 11:22:17 -0800 (Mon, 22 Dec 2008)
    Log Message:
    Partial fix to allow Array child of IVisualElementContainer to leverage includeIn (to avoid regression when
    Ryan changes Group's default property type to Array from Object).
    Bugs: SDK-18522
    QE Notes: None
    Doc Notes: None
    Tests: checkintests, States
    Ticket Links:
    http://bugs.adobe.com/jira/browse/SDK-18522
    Modified Paths:
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/rep/StatesModel.java
    flex/sdk/trunk/modules/compiler/src/java/flex2/compiler/mxml/rep/init/ValueInitializer.ja va

    Your CSS is unnecessarily verbose and redundant - many styles are simply restatements of the default.  Nevertheless, try changing this -
    .twoColFixRtHdr #container {
    width: 1000px; /* this overrides the text-align: center on the body element. */
    font-family: Arial, Helvetica, sans-serif, Verdana;
    font-size: 10px;
    font-style: normal;
    line-height: 14px;
    font-weight: 400;
    color: #000000;
    background-attachment: scroll;
    background-color: #FFFFFF;
    background-repeat: no-repeat;
    to this -
    .twoColFixRtHdr #container {
    width: 1000px; /* this overrides the text-align: center on the body element. */
    font-family: Arial, Helvetica, sans-serif, Verdana;
    font-size: 10px;
    line-height: 14px;
    color: #000000;
    background-color: #FFFFFF;
    margin:0 auto;
    (the missing styles are unnecessary)
    and see what happens.
    - The links I have set up appear to be clicking through but to old pages or no page at all - I presume this is only happening though because I don't have any pages loaded up to the live link above?
    Yes - that's the case.

  • Avoid dump when sy-lsind is 21

    Hi,
    How can we avoid dump when sy-lsind is 21?

    hi do like this..
    report message-id zmsg.
    start-of-selection .
    write:/ 'this is the basic list'.
    at line-selection.
    case sy-lsind .
    when 1.
    write:/ '1st list'.
    when 2.
    write:/ '2nd list'.
    when 3.
    write:/ '3st list'.
    when 4.
    write:/ '4st list'.
    when 5.
    write:/ '5st list'.
    when 6.
    write:/ '6st list'.
    when 7.
    write:/ '7st list'.
    when 8.
    write:/ '8st list'.
    when 9.
    write:/ '9st list'.
    when 10.
    write:/ '10st list'.
    when 10.
    write:/ '10st list'.
    when 11.
    write:/ '11st list'.
    when 12.
    write:/ '12st list'.
    when 13.
    write:/ '13st list'.
    when 14.
    write:/ '14st list'.
    when 15.
    write:/ '15st list'.
    when 16.
    write:/ '16st list'.
    when 17.
    write:/ '17st list'.
    when 18.
    write:/ '18st list'.
    when 19.
    write:/ '19st list'.
    when 20.
    write:/ '20st list'.
    sy-lsind = 1.
    message e000 with 'the list process is  not possible beyond'.
    endcase .
    regards,
    venkat

  • Avoiding attributes when using transform class

    Hi,
    One more help pls!!!!!
    When I use transform class and create an XML file, it creates with attributes for the nodes.
    For exapmle,
    <MessageOwner type="type" name="name">
    How do I avoid this type and name attributes?????
    Thanx and Regards,
    Gayathri.

    create a XSL that will not output the attibutes.

  • HOw to avoid DeadLocks when you schedule a Sql Server Agent Job and calling SSIS packages

    Hi All,
    I have scheduled 2 packages in in Sql Server Agent jobs .
    First job which is having Package 1 executing at 11 AM and where I am inserting the data in the table.
    Second job which is having Package 2 executing at 12 AM and where I am updating the data in the table based on the first job inserted records.
    When I am executing my first job it taking more time and executing till 12 AM and from 12 AM my job 2 also starting ,so getting deadlocks conflicts because inserting happening from job1 and updating happening from Job 2.
    How to avoid deadlocks and fix the issue.
    Please Suggest .
    Thanks & Regards,
    Anand

    Hi Anand,
    Here is another solution, you can set the Job 2 not to run based on a schedule, and create another SQL Server Agent Job which starts at 12 AM and run with a specified time interval to execute a SQL statement in which you do the following steps:
    1. Get the status information of Job 1 using the statement:
    DECLARE @i int;
    EXEC @i = msdb.dbo.sp_help_job @job_name = ‘Job Name'
    2. If the value of @i is 1 which means the status of job 1 is success and current time is, then start the job 2. So, the statement is as follows:
    IF @I = 1
    EXEC msdb.dbo.sp_start_job @job_name= ‘Job Name’
    Regards,
    Mike Yin
    TechNet Community Support

  • Avoid adjustment when printing from Okular

    Hi,
    I've written some documents in LaTeX and noticed that when I print the PDF from Okular, the alignment of the page is wrong and the margin on the left is bigger than the one on the right. Also, the top and bottom margins are wrong, too. When watching the file on the screen everything is fine and even.
    I then installed the Acrobat Reader and printed the file again, leaving every adjustment option unmarked and the output is fine.
    So, is there a way to avoid site adjustment in Okular? I couldn't find any options regarding this problem.
    Thanks in advance!
    Last edited by Barghest (2012-05-22 07:37:59)

    A friendly bump

  • How do I avoid duplicates when importing sequences?

    We're doing lots of collaborative editing at our company and just switched from FCP7 to premiere.  We're able to import sequences into projects just fine, but a HUGE problem arises with duplicates.  Each sequence we import brings in new master clips in the Project window, even though all that media already exists in the project.  If I delete it, the media disappears from the sequences that use it. 
    WHY!!!!?
    I assume this is user error.  We're still learning the software and collectively agree that this can't possibly be how Premiere is designed to operate.  What are we doing wrong, and how can we avoid balooning our project files each time we want to consolidate our editors' work?

    While I'm *really* looking forward to seeing the reality of Adobe Anywhere, it currently poses more questions than we have answers for, including how much horse power the server and central storage systems are going to need.  Even for a small shop with 3 edit bays I can see the server becoming pretty sluggish rendering all the frames that need to be sent to the clients, especially once effects are added.  And... what happens when some one decides it's time to export with some plugins that take all the CPU/GPU time up?    And then.... is this going to be included in the next Production Premium or is there going to be a massive premium added on top making it uneconomic for smaller shops?
    Until we know more.... we'll just have to keep editing individually and merging projects as needed.  
    -- back on topic ---
    As I said above, if you are importing projects from other editors it would not normally duplicate the footage.  If it's still doing it then there may be some path issues in the copied project.  In order to 'fix' those issues you can open the copied project they sent first (as a project, not as an import), reconnect all the media to your local media (this is usually just one or two clicks) then save it.   Now go back to your master project and import the sequence as before.  Because your copied project is now already connected to your local media it should not need to duplicate them.
    If it's STILL duplicating footage than perhaps you need to give us more specifics.....

  • How do I avoid duplicates when using "Automatically Add to iTunes"

    I recently consolidated all my music and then created a new library in iTunes. Now I'm using the "Automatically Add to iTunes" folder when I find more music from my archives.
    However, unlike when importing from a CD, iTunes doesn't seem to compare to existing library and detect duplicates in songs in this folder; it just adds them to iTunes. So I am ending up with dups. Is there any way to avoid this?
    Specs: Mac Mini running OSX 10.8.5; iTunes v. 12.0.1.26

    See this Apple support document.
    http://support.apple.com/kb/ht1751
    B-rock

Maybe you are looking for

  • IPod Recovery Mode Loop

    Every time I connect my 20GB iPod to iTunes (7.0.2.16) the message appears "itunes has detected an iPod in recovery mode. You must reset this iPod to use it with iTunes". I click reset, the iPod is reset to factory and I plug it into the power adapto

  • In iCloud, how to send an e-mail to a group of contacts, once I've created the group?

    I have created a group  from my iCloud contacts, but do not see how to send an e-mail message to this group. The help topics don't go this far.  Can anyone help?

  • Do the recovery discs come with an operating system?

         I was given a Toshiba satellite A215-S4747 a year ago. I don't have a recovery disc and can't do a restore from the hard disc. After putting windows 7 on it, it has been nothing but problems with the drivers and such. At this point I just want i

  • Please chek my modify code.

    Hi all My code for modifying the rows in my internal table is not working. **MODIFY STATEMENT *wa_scarr-carrid = 'RG1'. *wa_scarr-carrname = 'RG Airlines1'. *loop at it_scarr into wa_scarr. *wa_scarr-currcode = 'USD'. *modify it_scarr index 3 from wa

  • IP SLA ICMP Path Jitter - Strange results

    Hi all, I'm an intern in a network company, in France. I'm working on the IP SLAs fonctions of Cisco IOS. I've got some equipments to make some tests : I've configured the ICMP Path Jitter operation on R1 (a 2800 router), which has the IOS Software C