Read file, reformat the data, write new file

Oracle 11g PL/SQL.

I have a need to read an existing file, reformat the drive and write to a new file format.

My solution has been to read the file using utl_file and store it in an array of procedure1.  There is a column of data to hold 1000 bytes of data for each line of the file.

Then in procedure2, read the data through a cursor column, with a certain logic and fill in the fields of a record type object by using the function substr on the data column.  The type of record object has about 80 columns, all TANK types.  The OUT of procedure2 parameter would be the type of record object.

Then in procedure3, record object would be the parameter, and this recording would be used to write the new line of the file.  The problem I see now is that I can't convert the object record type a TANK in order to write the file.  So that would mean that I have to reference each of the 80 columns once again in procedure 3 and concatenate each for the parameter buffer utl_file.put_file.

I don't want to assign values for columns of 80 exit more than once because that makes the code very long and detailed, so I thought that I assign values to the time in the record object, then pass the record object to the write file procedure.

I'm looking for suggestions on a better design, or have I missed some very basic code design?

Thank you.

Thanks for all the great suggestions.

The original file is from a COBOL program.  What I ended up doing was reference and readability, I have defined/filled all fields of provision of COBOL in my program and then concatenated fields during the construction of the output string.  It's a bit verbose, since the 80s fields appear twice, but the code is clear and easy to understand for support purposes.

Thanks again for all the thoughtful suggestions.

Tags: Database

Similar Questions

  • Block size is too small - reformat the data store or create files VMDk 2?

    Hello

    I'm new to VMware and so far I absolutely love everything about her!  Well, I was not too happy when I realized that I can't create more than 256 GB a drive without reformatting the VMFS datastore.   Apparently, I accepted the block size of 1 MB by default during the installation...   I now need to configure a file server with about 500 GB of storage.  The data store with a larger block size (4 MB would be fine for me) reformatting is easy enough?  I am currently working on the first host ESXi 4.1 and will move to set up 2 more hosts in the coming weeks.  I read somewhere on the forum that ESXi 4.0 doesn't let you change the block size by default of 1 MB - is this true or relevant to 4.1?

    Currently, I have only 2 small VMs on that host, and these can be easily saved and put offline for a few hours, if necessary.  When starting the server, I created a single RAID array that holds ESXi and all virtual machines - does that mean that I have to reinstall ESXi in order to increase the size of the block?

    An alternative that I can get to is to simply create 2 255 GB VMDK each and load distribution of storage in the guest operating system (Win 2008).   Performance wise, is a disc more great and better (or worse) than the two smaller disks?

    On a related note, what should I choose for the "Independent" option when you add a new virtual disk?  Default is disabled (not independent).

    Your thoughts, focus and expertise are welcome and will be greatly appreciated!

    Thanks in advance,

    Dothan

    Dothan,

    You should power (after the virtual machine backup) remove the current data store and create a new one with the new block size. I did not have this on ESXi 4.1 again, however, he worked on ESXi 4.0.

    The maximum size of VMDK. If you want ot be able to take pictures, make sure you subtract twice the size of block in GB of the documented maximum size.

    Block size 1 MB--> 254 GB (= 256 GB, 2 GB)

    Block size of 2 MB--> 508 GB (= 512 GB - 4 GB)

    Size of block 4 MB--> GB 1 016 (= 1 024 GB - 8 GB)

    Block size of 8 MB--> GB 2 032 (= 2 048 GB to 16 GB)

    André

    EDIT: Just the KB for the maximum sizes. http://KB.VMware.com/kb/1012384

  • Decrement, then reformat the date entered

    I have a PDF form which needs to have read-ve dates filled after entering the last date in the pay period, like this:

    Field name > "Period Ending" > the user enters "15/04/2016" (this is the date on Friday)

    He now has fields AutoFill for LUNS, Mar, sea, Fri.   And these fields must be in the format 4/11, 4/12, 4/13, 4/14, 5/15

    I tried to copy the period ending the field for the field 'Fri' and change the date format, but I get an error in format.

    I guess there is a way to get the date from the entry field and subtract just 1,2,3,4 for other dates, which is how I would do it in Excel. Can't find a simple way to do it in Acrobat.

    You can learn a little more about how Javascript is used in the environment PDF. The only resource I know that deals only with JavaScript and Acrobat is this Book: Beginning JavaScript for Adobe Acrobat

    There are different ways you can do this math. What I like to do is to consolidate all the calculations in the script of a calculation, which I then store as a function of document level and then call only hidden and read only field in the form.

    You can also adjust the script slightly and use it as the custom for the domain calculation script 'Friday '; Replace the line that assigns the value to the field "Friday" with this:

    event.value = util.printd("mm/dd", theDate);
    
  • How can I reformat the date to express accounting2009 office

    the date on the invoices is defined as day, month, year. How I put it for the day, month, year

    Hi JustMe01,

    Please visit the following link:

    http://Office.Microsoft.com/en-us/accounting

    Thank you!

  • Reformatting the data into a clob

    I have an oracle table that I inherited that has a clob with data like this

    12:23:05 comment to the comment following log01:05:06
    in log01:10:06 journal ends



    I want to reformat to->

    12:23:05 comment to log
    01:05:06 comment then open a session
    01:10:06 journal ends

    Is this possible.
    Thank you
    Doug

    Try to customize this code:

    (1) src - the source to replace CLOB clob.
    (- 2) replace str - the string to be replaced.
    (--3) replace with - the replacement string.

    FUNCTION replaceClob)
    srcClob IN CLOB,
    replaceStr IN VARCHAR2,
    replaceWith IN VARCHAR2)
    RETURN CLOB IS

    vBuffer VARCHAR2 (32767).
    l_amount directory: = 32767;
    l_pos PLS_INTEGER: = 1;
    l_clob_len PLS_INTEGER;
    newClob CLOB: = EMPTY_CLOB;

    BEGIN
    -initialize the new clob
    DBMS_LOB.CREATETEMPORARY (newClob, true);

    l_clob_len: = dbms_lob.getlength (srcClob);

    Everything l_pos<>
    LOOP
    DBMS_LOB. Read (srcClob, l_amount, l_pos, vBuffer);

    IF vBuffer IS NOT NULL THEN
    -replace the text
    vBuffer: = replace (vBuffer, replaceStr, replaceWith);
    -write it in the new clob
    DBMS_LOB. WriteAppend (newClob, LENGTH (vBuffer), vBuffer);
    END IF;
    l_pos: = l_pos + l_amount;
    END LOOP;

    RETURN newClob;
    EXCEPTION
    WHILE OTHERS THEN
    LIFT;
    END;
    /

    Generally, you need to replace % _: _: _ % _: _: _ | Chr (10) | %

  • Move the data to another file system file - affects on the day before in a DG?

    If I want to move a file of data to another file system, because the current file system is full, I'd take the tablespace offline and unix, copy the data file to the new location and rename the tablespace to the new location.

    How would behave the night before in a dataguard environment? The DOF would apply, but could I take a tablespace offline space, waiting for read-only copy the data file on the unix sleep?

    Hello;

    I think that this would be ' rename a Datafile in the primary Database.

    If you don't rename the data corresponding to the watch system and then attempt to refresh the database backup control file, the standby database will attempt to use the data file renamed, but it will not enter into it. (the change is not propagated to the database pending)

    See Section 8.3.4 rename a data file in the primary database in the Document Oracle B14239-05 (Oracle10)

    This is a step by step on how to handle this.

    OR

    Chapter 9.3.4 rename a data file in the primary database in Oracle Document E10700-02 (Oracle 11)

    Best regards

    mseberg

    Published by: mseberg on December 1st, 2011 09:15

  • reformatting of data warehouses - Q fast

    Hello

    I have an ESXi server that is formatted with 2 x 2 TB partitions. The problem is that they are formatted with a block of 1 MB and I need to store large files on them.

    I thought to move all the data to 1 partition, then remove and re-add the partition now empty with a block of 8 MB. Once the other partition has been reformatted I intend to move all data above and delete/reload the remaining partition with a block of 8 MB.

    Is this ok to do? I was worried that it might affect the ESXi operating system somehow?

    See you soon,.

    H

    Hi Huwy

    This should be good.

    This will not affect the ESXi installation.

    If it's local storage and ESXi installation is on local disks, when you reformat the data store be sure to free space State use only.

    concerning

    Please reward points is you find this useful or correct

  • Reformatting my data store

    Hello

    I have a 1.36 Terabyte ATA drive in my ESXi machine. The maximum size of a VM is 256 gigabytes because my block size is 1 meg.

    I need to create a virtual 800 meg. Based on my reading I have to reformat the data store.

    I have two virtual machines on this data store I want to keep. My plan is to:

    1 export the two virtual to the FVO.

    2 remove the data from the VSphere Client store.

    3. Add the datastore to return. I need to reformat the data at the time store?

    If I am invited, I will choose 8 meg blocks so I can have large virtual methods.

    My plan is viable? I just can't remember if adding a store of data raises the need for a new format. Should I still remove the data store for the reformat once I exported the virtual methods in the ovf? I would like to go with the VSphere Client if possible since I'm not real handy with linux commands.

    Thanks in advance for any help.

    Mike Gallery

    Mike,

    (1) I would recommend export under VMs VMware, not OVFs.

    (2) Yes

    (3) Yes, you will be asked for the size on the creation of the data store.

    All this from the GUI.

  • Snapshot error (.. is larger than the maximum size supported by the data store)

    Hello

    I have a standalone DL360G5 with local storage. I have about 1.1 TB of storage (free in storage 1 TB)

    I have a virtual machine that is configured with a provisioning (256 GB of storage) which is currently 14 GB. He should get a site off backup server.

    When you take a snapshot of the next error message.

    'File '.

    The error message doesn't make sense because it takes only 14 GB of storage, and since I'm more Quen free 1 TB of storage should not be any problem.

    Someone knows how to solve this problem or to get a work around for a snapshot?

    Thank you

    I think that you will need to reformat the data with a block size store. By default, the maximum is 256GB. Slim doesn't help here as a snapshot could grow beyond.

  • Simple JavaScript to set the date

    Hello

    My simple JavaScript to fix the date runs in Acrobat Pro, but when I open the same document the reader he sets the date, but it fails with a pop off getField error dialog box... Here's the error tracking script...

    function populate_date()

    {

    var f = this.getField ("ToDay_Date");

    If (! f.value) f.value = util.printd ("d/m/yyyy", new Date());

    }

    populate_date(); call my function

    Above scripts executed when the document is opened. As a Pro, it is stored under Tools/JavaScripts/Document JavaScript...

    When I open it in the drive then I get the following while he dates the date presented too!

    The built-in functions of EScript Acrobat Version 11.0
    Acrobat SOAP 11.0

    TypeError: this.getField is not a function
    2:folder - level: App:Search Script.js

    I have not put right that I get this error...

    Kind regards

    Jeff P.

    I don't understand what you're talking about... The error message made clear reference to a script of level of the folder called 'search Script.js'.

    You must look for the source of the problem here.

  • How to read a text file that is longer than 65536 lines and write the data to a spreadsheet Excel and the data to write in a new column, once exhausted 65536 cells in a column?

    I have data to the basic generic text file format that must be converted into Excel spreadsheet format.  The data are much longer than 65536 rows and in my code, I was not able to find a way to see the data in the next column.  Currently, the conversion is done manually and generates an Excel file which has a total of 30-40 complete columns of data.  Any suggestions would be greatly appreciated.

    Thank you

    Darrick

    Here is a possible solution to the (potential) problem. Convert an array of strings and erase the data before writing to the file

  • How to write to an existing file, but replace the data just to the last row

    In my data acquisition system, the columns represent the channels and each represent line analysis of the data for all channels. It is easy to get the file write by add or replace a file exist. But sometimes I want to just overwriting new data in the last line in a file exist. for example: I have DAQ with 10 channels and scan all channels for three times in each race. So my data file will be 10 columns and 3 rows of each run if I put the file "append". next time I want to record the data by "crash" (so a single row of 3 scans) in the same file but just crash to 11th place (so I'm going to keep all the data I had previously). How to do this?

    Hi GPIB Analyzer.

    Why do you need to read the entire file?

    You can:

    -get the size of file with 'Get file size' or 'file info '.

    -set the position of reading with "Set file position.

    You should subtract the file size 1024, define what the position of the file read 1024 bytes. Now analyze this 1 KB of data, find the last line, set the file again, write to the file. No need to read the entire file.

    And as previously stated:

    How Labview should know the last line in the file without looking for him? You can do this research better than a simple brute force attack

  • Error message on Windows XP, "Windows-Delayed Write failed, windows was unable to save all the data for the file.

    I use windows xp as the operating system. I bought the new 3G huawei data card. While surfing internet, between a pop-up is displayed

    «Windows-delayed write failed, windows was unable to save all data in the file C:\Documents and settings\new\Local Settings\Application Data\Google\Chrome\User Data\Default\Session Storage\004285.log.» The data has been lost. This error can be caused by a failure of your computer hardware.

    After this computer freezes and I have to restart my computer. Please help me how to fix this problem.

    The error basically says that he tried to write something on your hard drive and for some reason that unfinished write operation.  This could indicate a bad sector on your hard disk, damaged disk or a problem with your hardware.

    Whenever a problem involving a disk read or write appears, my first approach is to perform a verify operation of the disc to the hard drive.  Even if this is not your problem, it is a step of good routine maintenance. Run the disk check with the "/ R" or "Repair" option.  Note that the real disk check will be presented at the next reboot, will run until Windows loads completely, cannot be interrupted and can take more than a few hours to run depending on the size of your hard drive, the quantity and type found corruption and other factors.   It is better to perform during the night or when you won't need your computer for several hours.

    'How to perform disk in Windows XP error Cherking'

    <>http://support.Microsoft.com/kb/315265/en-us >

    HTH,

    JW

  • Write delay failed unable to save all the data for the file $Mft

    Have a frustrating problem.  Help is greatly appreciated.  Learned the hard way and lost a dwg important issue which was unrecoverable.  Bought a new drive external hard seagate.  Could not back up the entire system with software pre-installed.  Download acronis true image home 2011.  Tried to backup system.  Receive error when trying to backup messages; 'Delay to failure of Scripture; Reading of the sector; Windows was unable to save all the data for the file $Mft. The data has been lost.  Have tried many fixes.  Unable to disable write caching method (grayed out / unclickable).  Played regedit 'EnableOplocks' is not listed to select.  Attempted to run microsoft 'fix it' and got the blue screen of death.  Short hair out of my head.  Suggestions appreciated.

    I don't know where Microsoft 'Technical support engineers' get their information.

    Write caching without a doubt "does apply to external hard drives", but it is usually disabled to prevent to sort the problem you are experiencing.

    I've seen several positions reporting to the same question that you do.  All of these positions were with SATA drives.  Is your Seagate eSATA drive?

    The disc is recognized as an external drive in Device Manager?  In Device Manager, go to the drive properties dialog box and click the policies tab.  An external drive should have two options: "Optimize for quick removal" and "Optimize for performance".  An internal hard drive shows the options as gray (with 'performance' selected), but there should also be a checkbox "Enable disk write cache" under the second option.

    What shows in your policies tab?

    If I understand correctly, "writeback" or "write behind" is implemented by disc material or its pilot.  If the option is not available on the drive properties > policies tab, I would suggest to contact Seagate support.

  • Reset permission to read the data of a XP machine files

    I recently had to move to Windows 7 XP Pro. I installed the new drives. I have two questions below.

    I have my old boot drive, that I'll use as an external (in a sleigh), but it has files I want to transfer my new readers.

    I tried it think I can just drad and fall, but was refused because of permissions. How can I change the permissions to get my own data of my drive?

    When should I reformat the hard drive to use as a drag and drop?

    My second drive (all data) is crushed and seagate he recovered since it is their problem. I have the rear disc and want to drag and drop on the new machine. -Since it's all data will know I have a permissions with this problem?

    Thanks in advance.

    I recently had to move to Windows 7 XP Pro. I installed the new drives. I have two questions below.

    I have my old boot drive, that I'll use as an external (in a sleigh), but it has files I want to transfer my new readers.

    I tried it think I can just drad and fall, but was refused because of permissions. How can I change the permissions to get my own data of my drive?

    When should I reformat the hard drive to use as a drag and drop?

    My second drive (all data) is crushed and seagate he recovered since it is their problem. I have the rear disc and want to drag and drop on the new machine. -Since it's all data will know I have a permissions with this problem?

    Thanks in advance.

    Just take ownership of files and folders where your files on the disk.

    How to: Make a file/folder in Windows 7

    Releasing it's easy: with Windows | ActiveWin | Laptops | Microsoft MVP

Maybe you are looking for