UTL_FILE Overwrites Data

Guys,
I am trying to write multiple files with multiple lines in each file. These files will be named with ID grabbed from cursor(Cursor 1 in code). This code does write multiple files and names the file name correctly. The only problem is in each file there are supposed to be multiple lines and it seems to overwrite all of these lines and it only input the header and the last line of data grabbed from cursor 2. Please help. I need a condition that says write all the lines first on the first file before moving to the next file. Data in each file are unique by the way. I am stuck please help
--SET FEEDBACK OFF
--SET TIME OFF
SET VERIFY OFF
SET SERVEROUTPUT ON SIZE 1000000
--SET ECHO ON;
--SET TERMOUT ON;
--SET FEEDBACK ON;
--SET PAGESIZE 24;
--SET LINESIZE 300;
--SET SPACE 2;
--SET HEADING ON;
DECLARE
companyID varchar2(15);
V_OUTPUT VARCHAR2(2000);
V_HEADER VARCHAR(2000);
V_PRODUCTION_PERIOD     DATE := '&&1';
v_taxhdl varchar2(1);
v_accounting_date number(6);
v_production_date number(6);
v_commodity varchar2(2);
p_filename varchar2(200);
fHandler UTL_FILE.FILE_TYPE;
--Getting the company codes into companyID variable
CURSOR C1 IS
SELECT DISTINCT company as companyID
FROM myTable
WHERE (commodity = 'CN'
AND accounting_date = TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('&&1','DD-MON-YYYY'),-1),'yyyymm'))
AND production_date = TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('&&1','DD-MON-YYYY'),-1),'yyyymm')))
OR (commodity != 'CN'
AND accounting_date = TO_NUMBER(TO_CHAR(TO_DATE('&&1','DD-MON-YYYY'),'yyyymm'))
AND production_date = TO_NUMBER(TO_CHAR(ADD_MONTHS(TO_DATE('&&1','DD-MON-YYYY'),-1),'yyyymm')))
ORDER BY company;
CURSOR C2(p_company number) IS
SELECT taxhdl, accounting_date, production_date, commodity
FROM myTable
WHERE (commodity = 'CN'
AND ACCOUNTING_DATE = to_number(to_char(ADD_MONTHS(TO_DATE('&&1','DD-MON-YYYY'),-1),'yyyymm'))
AND company = p_company )
OR (commodity != 'CN'
AND ACCOUNTING_DATE = to_number(to_char(TO_DATE('&&1','DD-MON-YYYY'),'yyyymm'))
AND company = p_company )
GROUP BY taxhdl, accounting_date,production_date,commodity
ORDER BY commodity, production_date;
--Setting the the Heading of the file
BEGIN
V_HEADER := ('COMPANY_ID'||','||'TAXHDL' || ',' || 'ACCOUNTING_DATE'|| ',' ||'PRODUCTION_DATE' || ',' ||'COMMODITY');
FOR REC IN C1 LOOP
companyID := REC.companyID;
p_filename := companyID||'.SUM'||'&&1'||'.csv';
FOR C2_REC IN C2(companyID) LOOP
v_taxhdl := C2_REC.taxhdl;
v_accounting_date := C2_REC.accounting_date;
v_production_date := C2_REC.production_date;
v_commodity := C2_REC.commodity;
V_OUTPUT := (companyID ||','||v_taxhdl|| ',' ||v_accounting_date||',' ||
v_production_date||','||v_commodity);
/*The part needs fixing*/
fHandler := UTL_FILE.FOPEN('myDir',p_filename,'w');
UTL_FILE.PUTF(fHandler,V_HEADER||'\n');
UTL_FILE.PUTF(fHandler,V_OUTPUT);
UTL_FILE.FCLOSE(fHandler);
END LOOP;
-- exception
-- when NO_DATA_FOUND then
-- utl_file.fclose(f);
END LOOP;
END;

When opening a file, a file pointer is created. This points to byte (or character) where any I/O operation on that file will start. Each I/O operation on the file, moves this file pointer accordingly.
In other words, when you do a read on that file, that is the point that the read will start reading data. When you write to the file, that is the point to which your buffer will be written to.
You can open a file into two way - reset or append.
When opening in reset mode, the file pointer is moved to the beginning of the file. This is what you typically want when opening a file and reading from it. You want to read from the very 1st byte in that file.
When opening in append mode, the file pointer is moved to the end of the file. This is what you typically want to do when you open a file and write to it. You want to start writing (appending) to the end of file.
What happens when you open a file in reset mode and start writing to it? You overwrite whatever was there at the beginning of the file.
How do you open the file in that loop? You do not use the append attribute - so no need to guess where the file pointer is when you write to it.
And as already commented - not a good idea to open and close the file in a loop. It is a huge overhead. Open the file once. Loop through the data and write it to file. Close the file.
If you want to make the changes written to file immediately visible to other processes, flush the I/O buffer in the loop after the I/O write statement.

Similar Messages

  • Overwrite data of master data infoobject

    Hi all,
    We have one master data infoobject ZASRYHMA. This infoobject does not have any attrbiutes but it has two compounding fields ZSITE and 0DISTR_CHAN.
    Now customer has a requirement in which value of ZASRYHMA can change for a particular site and distribution channel. Generally if this value changes then system creates a new entry in tables /bic/pzasryhma and /bic/szasryhma.
    What they want is to overwrite the existing entry.
    Is it possible to achieve?  It's a master data infoobject.
    Please provide your kind help.
    Regards,
    Nilima Rodrigues

    Hi,
    You have three fields as key field in table as shown below along with values,
    ZASRYHMA     ZSITE         0DISTR_CHAN
    A-1                     B-1            C-1
    A-2                     B-2            C-2
    now if you want to change the value of say second row to
    A-3                    B-2             C-2
    right?
    This is not possible just by overwritting in the info-object master data. Because these are key-fields system will treat A-3 as new value and create new entry, on top of this your A-2 master data values must have been used in transactional data.
    Only way I can think of is to delete the transactional data where ever A-2 is used and then delete ZASRYHMA master data and then upload master data for ZASRYHMA with new values. And then transacional data.

  • Overwrite data in the Planning Cube

    Hi Gurus,
    I am new to BPS, I have created a simple Manual planning layout for my users
    where they could enter their plan data for either plan or forecast version.
    As you all know the cube is always additive and cannot overwrite the Keyfigures directly
    I want to know if there is any in built planning function which would do that.
    For example Right now if the users first enter like
    Plant  Profit center version QTY
    1000  2200             SP0     100
    and they think the number 100 is too much and they want to readjust it 80
    they want to enter as 1000 2200  SP0 80 but cube is additive so it is making the QTY as 180 instead of 80.
    As of now they are entering as 1000 2200 SP0 -20 to adjust it to 80 which they don't want to do
    Hope I communicated well.
    Thanks
    Jay.

    The basic functionality of manual planning is to save the data in the cube the values which we enter in the layout. If we make 100 to 80 in the layout, after saving, cube will have 80 only, not 180. Ofcourse cube is additive, in the sense, to make the 100 to 80, system generates a record of -20 in the cube so that the overall result is 80. User doesnt need to enter -20 to have 80 in the cube. Recheck once again.

  • Writing out to file - and it seems to overwrite data

    I have written a program that reads in a file and then writes out XML. It works fine with small files but with files that are 1,310 kb it, seems to overwrite itself and i end up with a file that is missing its begining and middle pieces. I suspect that I am blowing out some buffer and a java component is reseting itself and overwriting the file, but i am scratching my head. Code below, please excuse the unformatted nature of the code.
    import java.io.BufferedReader;
    import java.io.BufferedWriter;
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.util.*;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    public class dl414image {
    public static String all = "";
    public static String fname = "";
    public static String lname = "";
    public static String mname = "";
    public static boolean aflag = false;
    public static boolean endofrec = false;
    public static boolean bflag = false;
    public static boolean cflag = false;
    public static boolean dflag = false;
    public static String xmldl;
    public static String xmlreq;
    public static String xml_issue_date;
    public static String xml_first_name;
    public static String xml_middle_name;
    public static String xml_last_name;
    public static String xml_dmvinfo;
    public static String xmlbday;
    public static String xmlsex;
    public static String xmlheight;
    public static String xmlweight;
    public static String xmleyecolor;
    public static String xmlhaircolor;
    public static String xml_licenseclass;
    public static String xml_licenseclassname;
    public static String xml_licenseissuedate;
    public static String xml_licenseexpiresdate;
    public static String dlstart = "<dlnumber>";
    public static String dlend = "</dlnumber>";
    public static String xmlreqstart = "<requestor_code>";
    public static String xmlreqend = "</requestor_code>";     
    public static String issue_date_start = "<issue_date>";
    public static String xml_issue_date_end = "</issue_date>";
    public static int count = 0;
    public static List<String> xml_abstractline = new ArrayList<String>();
    public static List<String> xml_cline = new ArrayList<String>();
    public static List<String> xml_dline = new ArrayList<String>();
    public static List<String> xml_acontinuedline = new ArrayList<String>();
    public static String dlold; // holds the previous DL number
    public static final String HEX_EXP = "[\\xFF]";
    public static final String CDATASTART = " <![CDATA[";
    public static final String CDATAEND = "]]>";
    public static String xmlfobates = "";
    public static String xmltypeappdate = "";
    public static String xml_licenseext;
    public static String xml_licenserestrict;
    public static String xml_licensedup;
    public static String xml_licenseheld;
    public static String xml_licenseseq;
    public static List<String> xml_abstract_item = new ArrayList<String>();
    public static List<String> xml_abstract_violationdate = new ArrayList<String>();
    public static List<String> xml_abstract_convictdate = new ArrayList<String>();
    public static List<String> xml_abstract_sectviolated = new ArrayList<String>();
    public static List<String> xml_abstract_statute = new ArrayList<String>();
    public static List<String> xml_abstract_file_number = new ArrayList<String>();
    public static List<String> xml_abstract_location_or_arn = new ArrayList<String>();
    public static List<String> xml_abstract_vehicle_license = new ArrayList<String>();
    public static final String ABST = "ABST";
    public static List<String> xml_reqNameAddress = new ArrayList<String>();
         /**<p>
         * This code reads in a file line by line
         * with BufferedReader and processes each
         * line.
         * @author Toren Valone
         public static void main(String[] args) {
              read("U:\\dlbig.txt"); //read this file
    //     convenience method to encapsulate
    //     the work of reading data.
         public static void read(String fileName) {
              xmlwriter("<?xml version=\"1.0\"?>");
              xmlwriter("<?xml-stylesheet type=\"text/xsl\" href=\"dl414.xsl\"?>" );
              xmlwriter("<dl_records>"); //write base element start tag
         try {
         BufferedReader in = new BufferedReader(
         new FileReader(fileName));
         String line;
         while ((line = in.readLine()) != null) {
              String cleanline = stripNonValidXMLCharacters(line);
         //our own method to do something
         handle(cleanline);
         //count each line
         count++;
         in.close();
         //show total at the end of file
         log("Lines read: " + count);
         } catch (IOException e) {
         log(e.getMessage());
         dlxmlwriter(); //final write for process
              xmlwriter("</dl_records>"); //write base element end tag
    //     does the work on every line as it is
    //     read in by our read method
         private static void handle(String line){
              if(line.length()> 0) {
              char fbyte = line.charAt(0);
              if(fbyte == 'A') {
              //just grab the very first dl
              if(count == 0) {
              dlold = line.substring(3,11);
              aflag = true;
              cflag = false;
              dflag = false;
              if(dlold.equalsIgnoreCase(line.substring(3,11))) {
              } else {
                   dlxmlwriter();
              //create Drivers License XML
                   xmldl = dlstart + line.substring(3,11) + dlend;
                   //grab f.o bates no only if its there otherwise write empty xml
              xmlfobates = "<fobates>" + line.substring(12,19) + "</fobates>";
              //grab type app and date
              xmltypeappdate = "<typeappdate>" + line.substring(20,28) + "</typeappdate>";
                   //Create Requestor code XML
              xmlreq = xmlreqstart + line.substring(51,56) + xmlreqend;
              //Create issue date XML
              xml_issue_date = issue_date_start + line.substring(57,63) + xml_issue_date_end;
              // clear name values, for now too stupid to figure out
              fname = "";
              mname = "";
              lname = "";     
              //Pulls the whole name string and sends it to namer function
              //to break up
              String name = line.substring(72);
              namer(name);
              //Create a string array and call get_Names which returns a
              //string array
              xml_first_name = "<first_name>" + fname + "</first_name>";
              xml_middle_name = "<middle_name>" + mname + "</middle_name>";
              xml_last_name = "<last_name>" + lname + "</last_name>";
                   //store Dl for comparison
                   store_old_dl(line);
              //Accent a and a length of 59 or 102 contains
              //the dmv info line
              if((fbyte == '?')& (line.length() == 59)){
                   String cleandmvinfo = regexReplacer(line.substring(38,58),"//","");
                   xml_dmvinfo = "<dmv_info_line>" + cleandmvinfo + "</dmv_info_line>";
              //Line length of 33 Birthdate, Sex, Height, Weight
              //Eye color hair color
              if ((line.length() == 33 ) & (aflag == true)) {
                   xmlbday = "<birth_date>" + line.substring(3, 9) + "</birth_date>";
                   xmlsex = "<sex>" + line.substring(11,12) + "</sex>";
                   xmlheight = "<height>" + line.substring(14,17) + "</height>";
                   xmlweight = "<weight>" + line.substring(18,21) + "</weight>";
                   xmleyecolor = "<eye_color>" + line.substring(22,27) + "</eye_color>";
                   xmlhaircolor = "<hair_color>" + line.substring(28,line.length()) + "</hair_color>";
    //Line length of 35 Birthdate, Sex, Height, Weight
              //Eye color hair color
              if ((line.length() == 31     ) & (aflag == true)) {
                   xmlbday = "<birth_date>" + line.substring(3, 9) + "</birth_date>";
                   xmlsex = "<sex>" + line.substring(11,12) + "</sex>";
                   xmlheight = "<height>" + line.substring(14,17) + "</height>";
                   xmlweight = "<weight>" + line.substring(18,21) + "</weight>";
                   xmleyecolor = "<eye_color>" + line.substring(22,27) + "</eye_color>";
                   xmlhaircolor = "<hair_color>" + line.substring(28,31) + "</hair_color>";
    // Line length of 56 Birthdate, Sex, Height, Weight
              //Eye color hair color for Annual reports
              if ((line.length() == 56     ) & (aflag == true)) {
                   xmlbday = "<birth_date>" + line.substring(3, 9) + "</birth_date>";
                   xmlsex = "<sex>" + line.substring(11,12) + "</sex>";
                   xmlheight = "<height>" + line.substring(14,17) + "</height>";
                   xmlweight = "<weight>" + line.substring(18,21) + "</weight>";
                   xmleyecolor = "<eye_color>" + line.substring(22,27) + "</eye_color>";
                   xmlhaircolor = "<hair_color>" + line.substring(28,31) + "</hair_color>";
              //If the line has an accent a and a length of 6
              if ((fbyte == '?')& (line.length() == 6)) {
              xml_licenseclass = "<license_class>" + line.substring(5,6) + "</license_class>";
              if ((fbyte == '?')& (line.length() == 8)) {
                   String cleanlc = regexReplacer(line.substring(4,8),"&","&");
                   xml_licenseclass = "<license_class>" + cleanlc + "</license_class>";
              if((line.length() == 61) & aflag==true) {
                   xml_licenseclassname = "<license_class_name>" + line.substring(3,9) + "</license_class_name>";
                   xml_licenseissuedate = "<license_issue_date>" + line.substring(9,16) + "</license_issue_date>";
                   xml_licenseexpiresdate = "<license_expires_date>" + line.substring(16,23) + "</license_expires_date>";
                   xml_licenseext = "<license_ext>" + line.substring(23,26) + "</license_ext>";
                   xml_licenserestrict = "<license_restrict>" + line.substring(26,37) + "</license_restrict>";          
                   xml_licensedup = "<license_dup>" + line.substring(38,43) + "</license_dup>";
                   xml_licenseheld = "<license_held>" + line.substring(44,44) + "</license_held>";
                   xml_licenseseq = "<license_seq>" + line.substring(57,61) + "</license_seq>";
              if(fbyte == 'B') {
                   bflag = true;
                   aflag = false; //ok got the a now turn switch off
                   String cleanabstract = regexReplacer(line.substring(1,line.length()),HEX_EXP,"");
                   cleanabstract = regexReplacer(cleanabstract,"&","&");
                   cleanabstract = regexReplacer(cleanabstract,"&","&apos;");
              if(cleanabstract.substring(3, 7).equalsIgnoreCase("ABST")){
                   if(cleanabstract.length() == 107) {               
                        xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,8) + "</abstract_item>");
                   xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                   xml_abstract_convictdate.add("<abs_convict_date>" + cleanabstract.substring(15,21) + "</abs_convict_date>");
                   xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                   xml_abstract_statute.add("<abs_statute>" + cleanabstract.substring(42,46) + "</abs_statute>");
                   xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
                   xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,99) + "</abs_location_or_arn>");
                   xml_abstract_vehicle_license.add("<abs_vehicle_license>" + cleanabstract.substring(100,107) + "</abs_vehicle_license>");               
                   if(cleanabstract.length() > 80 & cleanabstract.length() < 107) {               
                        xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,8) + "</abstract_item>");
                   xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                   xml_abstract_convictdate.add("<abs_convict_date>" + cleanabstract.substring(15,21) + "</abs_convict_date>");
                   xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                   xml_abstract_statute.add("<abs_statute>" + cleanabstract.substring(42,51) + "</abs_statute>");
                   xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
                   xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,cleanabstract.length()) + "</abs_location_or_arn>");
                   if(cleanabstract.length() < 80) {
                   System.out.println("****Change your assumtions about length*********");     
                        xml_abstractline.add("<abstract>" + cleanabstract + "</abstract>");
              if(cleanabstract.substring(3, 6).equalsIgnoreCase("ACC")){
                   if(cleanabstract.length() < 107) {
                        System.out.println("Acc looks like!!!" + cleanabstract);
                        System.out.println("Acc length=" + cleanabstract.length());
                   if(cleanabstract.length() > 102) {               
                             xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,6) + "</abstract_item>");
                        xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                        xml_abstract_convictdate.add("<abs_convict_date>" + " " + "</abs_convict_date>");
                        xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                        xml_abstract_statute.add("<abs_statute>" + " " + "</abs_statute>");
                        xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
                        xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,99) + "</abs_location_or_arn>");
                        xml_abstract_vehicle_license.add("<abs_vehicle_license>" + cleanabstract.substring(100,cleanabstract.length()) + "</abs_vehicle_license>");               
                   if((cleanabstract.length() > 77 ) & cleanabstract.length() < 102) {               
                             xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,6) + "</abstract_item>");
                        xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                        xml_abstract_convictdate.add("<abs_convict_date>" + " " + "</abs_convict_date>");
                        xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                        xml_abstract_statute.add("<abs_statute>" + " " + "</abs_statute>");
                        xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,cleanabstract.length()) + "</abs_file_number>");
                        xml_abstract_location_or_arn.add("<abs_location_or_arn>" + "</abs_location_or_arn>");
                        xml_abstract_vehicle_license.add("<abs_vehicle_license>" + "</abs_vehicle_license>");               
              if((fbyte == ' ') & (bflag == true)) {
                   String cleanabstract = regexReplacer(line.substring(1,line.length()),HEX_EXP,".");
                   cleanabstract = regexReplacer(cleanabstract,"&","&");
                   cleanabstract = regexReplacer(cleanabstract,"'","&apos;");
                   if(cleanabstract.substring(3, 7).equalsIgnoreCase("ABST")){
                             if(cleanabstract.length() == 107) {               
                                  xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,8) + "</abstract_item>");
                             xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                             xml_abstract_convictdate.add("<abs_convict_date>" + cleanabstract.substring(15,21) + "</abs_convict_date>");
                             xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                             xml_abstract_statute.add("<abs_statute>" + cleanabstract.substring(42,51) + "</abs_statute>");
                             xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
                             xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,99) + "</abs_location_or_arn>");
                             xml_abstract_vehicle_license.add("<abs_vehicle_license>" + cleanabstract.substring(100,107) + "</abs_vehicle_license>");               
                             if(cleanabstract.length() > 93 & cleanabstract.length() < 107) {               
                                  xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,8) + "</abstract_item>");
                             xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                             xml_abstract_convictdate.add("<abs_convict_date>" + cleanabstract.substring(15,21) + "</abs_convict_date>");
                             xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                             xml_abstract_statute.add("<abs_statute>" + cleanabstract.substring(42,51) + "</abs_statute>");
                             xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
                             xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,cleanabstract.length()) + "</abs_location_or_arn>");
                             xml_abstract_vehicle_license.add("<abs_vehicle_license>" + "</abs_vehicle_license>");               
                   if(cleanabstract.substring(3, 6).equalsIgnoreCase("ACC")){
                             if(cleanabstract.length() > 102) {               
                                       xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,6) + "</abstract_item>");
                                  xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                                  xml_abstract_convictdate.add("<abs_convict_date>" + " " + "</abs_convict_date>");
                                  xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                                  xml_abstract_statute.add("<abs_statute>" + " " + "</abs_statute>");
                                  xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,79) + "</abs_file_number>");
                                  xml_abstract_location_or_arn.add("<abs_location_or_arn>" + cleanabstract.substring(79,99) + "</abs_location_or_arn>");
                                  xml_abstract_vehicle_license.add("<abs_vehicle_license>" + cleanabstract.substring(100,cleanabstract.length()) + "</abs_vehicle_license>");               
                             if((cleanabstract.length() > 77 ) & cleanabstract.length() < 102) {               
                                       xml_abstract_item.add("<abstract_item>" + cleanabstract.substring(3,6) + "</abstract_item>");
                                  xml_abstract_violationdate.add("<abs_violation_date>" + cleanabstract.substring(8,14) + "</abs_violation_date>");
                                  xml_abstract_convictdate.add("<abs_convict_date>" + " " + "</abs_convict_date>");
                                  xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                                  xml_abstract_statute.add("<abs_statute>" + " " + "</abs_statute>");
                                  xml_abstract_file_number.add("<abs_file_number>" + cleanabstract.substring(67     ,cleanabstract.length()) + "</abs_file_number>");
                                  xml_abstract_location_or_arn.add("<abs_location_or_arn>" + "</abs_location_or_arn>");
                                  xml_abstract_vehicle_license.add("<abs_vehicle_license>" + "</abs_vehicle_license>");               
                   if(cleanabstract.length() == 46) {
                   if(cleanabstract.substring(22, 25).equalsIgnoreCase("CDL") & cleanabstract.length() == 46) {
                   xml_abstract_item.add("<abstract_item>" + "</abstract_item>");
                        xml_abstract_violationdate.add("<abs_violation_date>" + "</abs_violation_date>");
                        xml_abstract_convictdate.add("<abs_convict_date>" + "</abs_convict_date>");
                        xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,43) + "</abs_section_violated>");
                        xml_abstract_statute.add("<abs_statute>" + cleanabstract.substring(42,cleanabstract.length()) + "</abs_statute>");
                        xml_abstract_file_number.add("<abs_file_number>" + "</abs_file_number>");
                        xml_abstract_location_or_arn.add("<abs_location_or_arn>" + "</abs_location_or_arn>");
                        xml_abstract_vehicle_license.add("<abs_vehicle_license>" + "</abs_vehicle_license>");               
                   if(cleanabstract.length()> 39 & cleanabstract.length() < 43     ) {
                   if(cleanabstract.substring(22, 25).equalsIgnoreCase("DMV")) {
                        System.out.println("DMV length=" + cleanabstract.length());
                        xml_abstract_item.add("<abstract_item>" + "</abstract_item>");
                        xml_abstract_violationdate.add("<abs_violation_date>" + "</abs_violation_date>");
                        xml_abstract_convictdate.add("<abs_convict_date>" + "</abs_convict_date>");
                        xml_abstract_sectviolated.add("<abs_section_violated>" + cleanabstract.substring(22,cleanabstract.length()) + "</abs_section_violated>");
                        xml_abstract_statute.add("<abs_statute>" + "</abs_statute>");
                        xml_abstract_file_number.add("<abs_file_number>" + "</abs_file_number>");
                        xml_abstract_location_or_arn.add("<abs_location_or_arn>" + "</abs_location_or_arn>");
                        xml_abstract_vehicle_license.add("<abs_vehicle_license>" + "</abs_vehicle_license>");               
                   xml_abstractline.add("<abstract>" + cleanabstract + "</abstract>");
              if(fbyte == 'C') {
                   //turn b flag off
                   aflag = false;
                   bflag = false;
                   cflag = true;
                   String cleancomment = regexReplacer(line.substring(1,line.length()),HEX_EXP,"");     
                   cleancomment = regexReplacer(cleancomment,"&","&");
                   cleancomment = regexReplacer(cleancomment,"'","&apos;");
                   xml_cline.add("<comment_line>" + cleancomment.substring(1,63) + "</comment_line>");
                   xml_reqNameAddress.add("<requestor_name_or_address>" + cleancomment.substring(63,cleancomment.length()) + "</requestor_name_or_address>");
                   System.out.println("In C code dl=" + xmldl + "aflag=" + aflag +"bflag=" + bflag + "cflag=" + cflag);           
              if((fbyte == ' ') & (cflag == true)){
                   String cleancomment = regexReplacer(line.substring(1,line.length()),HEX_EXP,"");     
                   cleancomment = regexReplacer(cleancomment,"&","&");
                   if(cleancomment.length() > 63) {
              xml_reqNameAddress.add("<requestor_name_or_address>" + cleancomment.substring(63,cleancomment.length()) + "</requestor_name_or_address>");
              xml_cline.add("<comment_line>" + cleancomment.substring(1, 63) + "</comment_line>");
                   } else {
                        xml_cline.add("<comment_line>" + cleancomment.substring(1, cleancomment.length()) + "</comment_line>");
              if(fbyte == 'D') {
                   xml_dline.add("<action>" + line.substring(1, line.length()) + "</action>");
                   dflag = true;
                   cflag = false;
                   System.out.println("In d code dl=" + xmldl + "aflag=" + aflag +"bflag=" + bflag + "cflag=" + cflag + "dflag=" + dflag);
              } // ends d if
              //If D line sets it to true then this will never run
              if((fbyte == ' ') & (dflag == true)) {
                   xml_dline.add("<action>" + line.substring(1, line.length()) + "</action>");
              }     //end if line length greater than zero
         }// ends handle     
         public static void store_old_dl(String line) {
              dlold = line.substring(3,11);
         public static void dlxmlwriter(){
    xmlwriter("<dl_record>");
         xmlwriter(xmldl);
         xmlwriter(xmlfobates);
         xmlwriter(xmltypeappdate);
         xmlwriter(xmlreq);
         xmlwriter(xml_issue_date);
         xmlwriter(xml_first_name);
         xmlwriter(xml_middle_name);
         xmlwriter(xml_last_name);
         xmlwriter(xml_dmvinfo);
         xmlwriter(xmlbday);
         xmlwriter(xmlsex);
         xmlwriter(xmlheight);     
         xmlwriter(xmlweight);
         xmlwriter(xmleyecolor);
         xmlwriter(xmlhaircolor);
         xmlwriter(xml_licenseclass);
         xmlwriter(xml_licenseclassname);
         xmlwriter(xml_licenseissuedate);
         xmlwriter(xml_licenseexpiresdate);
         xmlwriter(xml_licenseext);
         xmlwriter(xml_licenserestrict);
         xmlwriter(xml_licensedup);
         xmlwriter(xml_licenseheld);
         xmlwriter(xml_licenseseq);
         int a = 0;
         while (a < xml_abstractline.size()) {
              xmlwriter(xml_abstractline.get(a).toString());
              a++;
         int a1 = 0;
         while (a1 < xml_abstract_item.size()) {
              xmlwriter(xml_abstract_item.get(a1).toString());
              a1++;
         int a2 = 0;
         while (a2 < xml_abstract_violationdate.size()) {
              xmlwriter(xml_abstract_violationdate.get(a2).toString());
              a2++;
         int a3 = 0;
         while (a3 < xml_abstract_convictdate.size()) {
              xmlwriter(xml_abstract_convictdate.get(a3).toString());
              a3++;
         int a4 = 0;
         while (a4 < xml_abstract_sectviolated.size()) {
              xmlwriter(xml_abstract_sectviolated.get(a4).toString());
              a4++;
         int a5 = 0;
         while (a5 < xml_abstract_statute.size()) {
              xmlwriter(xml_abstract_statute.get(a5).toString());
              a5++;
         int a6 = 0;
         while (a6 < xml_abstract_file_number.size()) {
              xmlwriter(xml_abstract_file_number.get(a6).toString());
              a6++;
         int a7 = 0;
         while (a7 < xml_abstract_location_or_arn.size()) {
              xmlwriter(xml_abstract_location_or_arn.get(a7).toString());
              a7++;
         int a8 = 0;
         while (a8 < xml_abstract_vehicle_license.size()) {
              xmlwriter(xml_abstract_vehicle_license.get(a8).toString());
              a8++;
         int d = 0;
         while (d < xml_cline.size()) {
              xmlwriter(xml_cline.get(d).toString());
              d++;
         int e = 0;
         while (e < xml_dline.size()) {
              xmlwriter(xml_dline.get(e).toString());
              e++;
         int f = 0;
         while (f < xml_reqNameAddress.size()) {
              xmlwriter(xml_reqNameAddress.get(f).toString());
              f++;
         dflag = false;
         //writes the entag for dlnumber and dl record
    xmlwriter("</dl_record>");
         xml_abstractline.clear();
         xml_cline.clear();
         xml_dline.clear();
         xml_abstract_item.clear();
         xml_abstract_violationdate.clear();
         xml_abstract_convictdate.clear();
         xml_abstract_sectviolated.clear();
         xml_abstract_statute.clear();
         xml_abstract_file_number.clear();
         xml_abstract_location_or_arn.clear();
         xml_abstract_vehicle_license.clear();
         xml_reqNameAddress.clear();
         public static void xmlwriter(String writestring){     
              String filename = "U:\\dl.xml";
                   try {
                        FileWriter myFW = new FileWriter(filename, true);
                        BufferedWriter out = new BufferedWriter(myFW);     
    out.flush();
                        out.write(writestring);
                        out.newLine();
                        out.close();
                   } catch (IOException f) {
                        System.out.println("Error -- " + f.toString());
                   }// ends catch
    //     convenience to save typing, keep focus
         private static

    Ok, here is the snippet that I think is having problems
    static void xmlwriter(String writestring){
    String filename = "U:dl.xml";
    try {
    FileWriter myFW = new FileWriter(filename, true);
    BufferedWriter out = new BufferedWriter(myFW);
    out.flush();
    out.write(writestring);
    out.newLine();
    out.close();
    } catch (IOException f) {
    System.out.println("Error -- " + f.toString());
    }// ends catch
    I call this for everyline written, and as I watch the file bytes count up, I then see it reset to zero and start over. Could this be something to do with creating a new buffer for every line?

  • Name of the file (in utl_file) with date and time

    Instead of the below:
    vHandle1 := utl_file.fopen('/home/oracle/testdir', 'test.csv', 'W');
    I want something like this:
    vHandle1 := utl_file.fopen('/home/oracle/testdir', 'test19dec200611.35.csv', 'W');
    i.e the name of the file should have the date and time too so that every time the original is not overwritten.
    Is this possible?

    OR maybe we can use this:
    utl_file.frename('/home/oracle/testdir','test.csv,'/home/oracle/testdir','test'||to_char(sysdate,'DDMONYYYYHH24:MI')||'.csv',TRUE);
    Will it work?
    Can we download this file and open it through oracle (and not any front end like ASP etc.)

  • Insert a line into the beginning of a file without overwriting data

    I would like to dynamically alter/add new headers to a csv file as needed. The code I have below overwrites the previously written data an amount equal to each new header added each time I call the vi below. Any suggestions on how to do this without reading in the file each time? I want to avoid the processing time of reading in the file between processing new data.
    Thanks!
    Attachments:
    R900 - Log Data Stream to File.vi ‏22 KB

    Yes, but you can still write everytime, you dont need to read the file back.
    /Y
    LabVIEW 8.2 - 2014
    "Only dead fish swim downstream" - "My life for Kudos!" - "Dumb people repeat old mistakes - smart ones create new ones."
    G# - Free award winning reference based OOP for LV

  • Metadata templates overwrite 'Date created'

    I've experienced this frustrating problem for years but now need to do something about it.
    I have a metadata template which I apply to my pictures but everytime this action is performed I'm left with the creation date of the images changed to the date that I created the template (3 years ago)
    This problem has been present through all versions of Photoshop that I've used from CS2 to CS5.
    Does anyone know why this happens and if there is a way around it?

    Have you checked your template for Date Created?

  • Tidynetworks overwrites data I'm viewing. How to prevent????

    When view catalog or craiglist information, TidyNetwork.com and probably others are overwriting the area I'm trying to read/view. This only recently started. I upgraded to latest version of Firefox to this being a problem. I also downloaded some software from CNET which seem to download more than I was asking for. I tried restricting the site but it seems to get in regardless.

    '''Try Firefox Safe Mode''' to see if the problem goes away. [[Troubleshoot Firefox issues using Safe Mode|Firefox Safe Mode]] is a troubleshooting mode that turns off some settings and disables most add-ons (extensions and themes).
    ''(If you're using an added theme, switch to the Default theme.)''
    If Firefox is open, you can restart in Firefox Safe Mode from the Help menu by clicking on the '''Restart with Add-ons Disabled...''' menu item:<br>
    [[Image:FirefoxSafeMode|width=520]]<br><br>
    If Firefox is not running, you can start Firefox in Safe Mode as follows:
    * On Windows: Hold the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac: Hold the '''option''' key while starting Firefox.
    * On Linux: Quit Firefox, go to your Terminal and run ''firefox -safe-mode'' <br>(you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshoot extensions, themes and hardware acceleration issues to solve common Firefox problems]] article to find the cause.
    ''To exit Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    When you figure out what's causing your issues, please let us know. It might help others with the same problem.

  • Sync mac to iphone (overwrite data on mac)

    Hello. My Calendar data on mac got erased. I can't restore them, but the data still exist on my iphone (and nowhere else). The erase on the mac is younger than the data on the iphone. So i fear that synching the two the usual way would bring the iphone up to the state of the Calendar on the mac, meaning it would erase all data on the iphone. I can't try it out, because I guess I have one shot only. So I thought I'll see if there's a way to do a one way sync somehow. Is there?
    Thanks

    The way to sync the calendar from your iPhone to your Mac is by hand ... type all the entries from your iPhone's calendar into your Mac.

  • Will empty new Outlook calendar overwrite data on iCloud cal?

    If I sync my existing calendar on iCloud to a new, empty outlook calendar on my PC, will the newer blank (Outlook) calendar overwrite all entries in iCloud calendar in the sync process?

    See also Recover your iTunes library from your iPod or iOS device.
    tt2

  • How to overwrite data base connection in SSIS

    Hi,
    I wanted to know how to overwrite database connection in SSIS & how do we call a database connection in SSIS.
    Links will also help.
    Regards,
    Ajay

    >> how do we call a database connection in SSIS.
    New OLE DB Connection can be created and SQL Server name and DB name should be provided.
    Please refer:
    SQL Server Integration Services (SSIS) Connection Managers
    >> how to overwrite database connection in SSIS
    Dynamically set the Connection String by using Variable expression or setting it via Script Task.
    Please refer:
    Dynamic Connection Strings in SSIS
    Reza Rad's Technical blog: Dynamic connection string in SSIS
    - Vaibhav

  • Office 2011 Task sync with Exchange Server is overwriting data

    Originally posted at answers.microsoft.com. No help there. They suggested I try posting here:
    A little background in case it's important:
    SBS2008 Server w/ Exchange v7 8.01.0340.000
    I run an RDC connection to a virtual server running Office 2010 (this is not the same server hosting Exchange)
    I run a Mac with OSX 10.6.8 and Office 2011
    I use both of these workspaces simultaneously. Previous to installing Office 2011 last month, I ran Office 2010 from the RDC connection. Everything worked fine from that side.
    Now that I'm using Outlook 2011 task management is very strange at times. I'm in MacOS 95% of my day. I'd prefer to use Outlook 2011 rather than 2010 through an RDC connection, which is the reason I purchased 2011.
    The issue(s): Suppose I create a task in Outlook 2011, and save it; then, later I go back to make edits. If Outlook happens to sync while I have the task open in edit mode, it will get overwritten with the previously saved version. The only workaround
    I have found so far is to hit the cmd-s button nearly as frequently as punctuation. At least I never lose more than a sentence fragment.
    However, one thing that I can not seem to resolve at all is completion status. If I ever have occasion to re-activate a completed task--which does happen--toggling the 'completed' button back off and saving the task does not re-set its status back
    to active. The 'task complete' flag seems to fall outside of the purview of the save function. So, while hitting 'save' regularly when editing tasks retains the data, every time exchange syncs with the tasks, it will mark the task completed again.
    I have double/triple checked the server's time and my workstation's time are the same--down to the second. I've tried closing the Outlook 2010 application on the PC. I've fiddled with the sync services preferences in Outlook 2011 to sync to the
    Exchange server, to my computer (and combinations of both); I've set the outlook folder to add new items to the Exchange server and to the local machine. The results are always the same as outlined above.

    Hi,
    Please start Outlook in safe mode and check whether the issue persists. Also make sure there is no third-party autispam program installed in your machine. If there is, please disable it to have a try.
    Personal suggestion, if the issue only happens on your Mac with OSX 10.6.8 and Office 2011, I suggest we can ask a question in Outlook 2011 for Mac forum in Microsoft for more help:
    http://answers.microsoft.com/en-us/mac/forum/macoutlook?tab=Threads
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us.
    Thank you for your understanding.
    Regards,
    Winnie Liang
    TechNet Community Support

  • Bug: "Paste Special: Value" overwrites data hidden with Table filters

    I've noticed the following....
    Create a sheet with the values below and enable the "Filter" option on this table.
    (I've added the row-numbers on the left, to later show the filter in action)
    (1) col1
    col2
    (2) a 1
    (3) a 2
    (4) a 3
    Using the filter option on the col2 column, unmark value "2".
    This is an essential step, since the bug only appears when hiding rows -in between- of other rows.
    Hiding 1 or 3 will not have the same result.
    You table should now look like this. Notice row (3) is hidden, as it should be:
    (1) col1
    col2
    (2) a 1
    (4) a 3
    Now type "b" in a random empty cell, select the cell (not the value), and copy it.
    Now, and this is an essential step, click down on the "a" value on row (2), keeping your mouse pressed, drag to the "a" value on row (4),  so that both cells are selected with one selection box, not two separate boxes.
    Within this selection box, right-mouse click, and select "Paste Special -> Values" NOT "Paste Special -> Paste".
    Now use the filter to unhide value "2". You table should/will look like this:
    (1) col1
    col2
    (2) b 1
    (3) b 2
    (4) b 3
    This is -not- the expected behavious, when using "Paste Special -> Paste", the result is
    as expected:
    (1) col1 col2
    (2) b 1
    (3) a 2
    (4) b 3
    This issue is also present in Excel 2010, and i've tested this on various computers.

    Tested in Excel 2013, it also happens there.

  • How to save data series in a file with possibility to overwrite last line

    How to manage write/overwrite data on selected lines in a file?

    it depends what sort of datafile you have.
    on a spreadsheet file you could read the whole file, overwrite or insert data and resave it.

  • Is it possible to overwrite xy graph data?

    I have an xy graph visualizing data in every 30ms. I want to overwrite data for some time (controlled with a start/stop button) on the graph without appending incoming arrays. I know that it is possible with the picture plot, but is it also possible with the xy graph? Thanks
    Ogulcan

    > No actually I want the graph(xy graph not the picture control) to keep
    > the old data too. But this should be without appending the incoming
    > data.
    Graphs erase and redraw each time data is written to their terminal.
    There is an XY chart example that pushes the append in to a subVI and
    allows you to easily control the amount of data retained.
    I think you are looking for the graphics of the graph to be retained
    without the original data, which is what the picture control is capable
    of. Since this won't work with cursors, panning, or zooming, the XY
    graph doesn't offer it as an option. If you combine the XY graph
    picture control examples with the erase first option, you can get an XY
    graph that does this in the picture with a minim
    um of programming.
    Greg McKaskle

Maybe you are looking for