Record count in txt file
Hi Experts,
Actually I have an output file with 3 records as like this
sl.no,EmpNo,EmpName
1,1001,abc
2,1002,xyz
3,1003,lkj
but the required output was i dont need the header record instead in that place i require current date, company name and recordcound such as
06/23/2009,CompanyName,4 (Record count includes number of records + Header Record i.e 3+1=4)
so i just want to know how to populate the record count, i have 3 differient nodes with same fields where in based on some condition any one of the nodes will execute how to count the records..
regards,
sai
hi,
u r understanding was correct and just want to know how the record count is handled
rgrds,
sai
Similar Messages
-
Hello! This is my first time in this discussion group. The question posed is the subject line itself:
What is the smallest data structure record in a .TXT file record to be recognized as an Apple Address Book "Data Card"?
I'm lazy! As a math instructor with 40+ students per class per semester (pCpS), I would rather not have to create 40 data cards pCpS by hand, only to expunge that info at semester's end. My college's IS department can easily supply me with First name, Last name, and eMail address info, along with a myriad of other fields. I can manipulate those data on my end to create the necessary .TXT file, but I don't know the essential structure of that file.
Can you help me?
Thank you in advance.
BillHello Bill, & welcome aboard!
No idea what pCpS is, sorry.
To import a text file into Address Book, it needs to be a comma delimited .csv file, like...
Customer Name,Company,Address1,Address2,City,State,Zip
Customer 1,Company 1,2233 W Seventh Street,Unit 543,Seattle,WA,99099
Customer 2,Company 2,1 Park Avenue,,New York,NY,10001
Customer 3,Company 3,65 Loma Linda Parkway,,San Jose,CA,94321
Customer 4,Company 4,89988 E 23rd Street,B720,Oakland,CA,99899
Customer 5,Company 5,432 1st Avenue,,Seattle,WA,99876
Customer 6,Company 6,76765 NE 92nd Street,,Seattle,WA,98009
Customer 7,Company 7,8976 Poplar Street,,Coupeville,WA,98976
Customer 8,Company 8,7677 4th Ave North,,Seattle,WA ,89876
Customer 9,Company 9,4556 Fauntleroy Avenue,,West Seattle,WA,98987
Customer 10,Company 10,4 Bell Street,,Cincinnati,OH,89987
Customer 11,Company 11,4001 Beacon Ave North,,Seattle,WA,90887
Customer 12,Company 12,63 Dehli Street,,Noida,India,898877-8879
Customer 13,Company 13,63 Dehli Street,,Noida,India,898877-8879
Customer 14,Company 14,63 Dehli Street,,Noida,India,898877-8879
Customer 15,Company 15,4847 Spirit Lake Drive,,Bellevue,WA,98006
Customer 16,Company 16,444 Clark Avenue,,West Seattle,WA,88989
Customer 17,Company 17,6601 E Stallion,,Scottsdale,AZ,85254
Customer 18,Company 18,801 N 34th Street,,Seattle,WA,98103
Customer 19,Company 19,15925 SE 92nd,,Newcastle,WA,99898
Customer 20,Company 20,3335 NW 220th,2nd Floor,Edmonds,WA,99890
Customer 21,Company 21,444 E Greenway,,Scottsdale,AZ,85654
Customer 22,Company 22,4 Railroad Drive,,Moclips,WA,98988
Customer 23,Company 23,89887 E 64th,,Scottsdale,AZ,87877
Customer 24,Company 24,15620 SE 43rd Street,,Bellevue,WA,98006
Customer 25,Company 25,123 Smalltown,,Redmond,WA,98998
Try Address Book Importer...
http://www.sillybit.com/abee/ -
Find Record count in a file.
Hi,
Is it possible to find the total no. of records (lines) in a file?
With External Table: and using select count(*) on that external table.
But here, we will only get the rows which are valid. Non Valid records will go to the bad file.
Another ways is: Reading the entire file using utl_file.get_line and then incrementing a counter.
But, we need to read through the whole file just to get the count.
Is there any better way of doing this?
Any suggestions?
( I accept sql/plsql is for db related things and not to handle OS related tasks. But I don't like writing a seperate shell script for this small thing because, I just moved every thing like data load, emailing etc in to plsql from unix and proc :) )
Version:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi
PL/SQL Release 10.2.0.1.0 - Production
Unfortunately No Java is Installed
Thanks in advance,
Pradeep.pradeep.vupala wrote:
Hi,
Is it possible to find the total no. of records (lines) in a file?
With External Table: and using select count(*) on that external table.
But here, we will only get the rows which are valid. Non Valid records will go to the bad file.
Another ways is: Reading the entire file using utl_file.get_line and then incrementing a counter.
But, we need to read through the whole file just to get the count.
Is there any better way of doing this?Not really, that's just about your two ways.
1 alternative...
You could set up a dummy external table pointing to the file that just has a single column of varchar2 with no delimiters so it reads a line at a time, and won't get any bad rows, then do a count(*) on that table. -
Records count in Receiver File Adapter
Hi All,
I have a scenario IODC to File. The requirement is to get the total record count in the Trailer record of the Target File .Please help.
Regards,
KevinHello,
The requirement is to get the total record count in the Trailer record of the Target File
In your XML, decide which IDOC field you get your records from and then do a similar mapping
IDOC field -> removeContext -> count -> TrailerRecordfield
Hope this helps,
Mark -
Reading Last line(record) from a txt file ina java
Hi,
I want to retrive the last line from a txt file.Can anybody help me??
Thanx in advanceIn order to read the last line you must read all the lines before it. To read lines you can use the BufferedReader and LineNumberReader classes.
Here's an example of how to read lines of text from a file:
http://javaalmanac.com/egs/java.io/ReadLinesFromFile.html -
Inserting records from a txt file to a database table
I would like to know how to insert records from a file (txt) to a database table through a java application?
[BufferedReader |http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.html] and PreparedStatement
IO and JDBC -
How do i Sort my records in a txt file.
Hi , i am doing a ranking system that is rank by the user number of attempts to finish the game .
Player are ranked best as able finish the game with LEAST amount of attempts.
This is the record that i have in my *.txt based on
(win,NumberOfAttempts,playerName)
win,4,hehehe
win,2,hahaha
win,3,jjjjjjj
win,6,kkkk
win,3,mmmnnn
What sort method can i use to sort the player base on NumberOfAttempts (2nd values of each line)
I saw something like import java.ultis.collections which got a sorting but i dont know how to use it..
anyone can introduce me the best and easy sort that i can use for my ranking? Thanks
If possible give me a example.
Sorry for the troubles and thanks for the help.It's static class 'Arrays', not array. Check the API doco.
sort
public static void sort(Object[] a)
Sorts the specified array of objects into ascending order, according to the
natural ordering of its elements. All elements in the array must implement
the Comparable interface. Furthermore, all elements in the array must be
mutually comparable (that is, e1.compareTo(e2) must not throw a
ClassCastException for any elements e1 and e2 in the array).
This sort is guaranteed to be stable: equal elements will not be reordered
as a result of the sort.
The sorting algorithm is a modified mergesort (in which the merge is
omitted if the highest element in the low sublist is less than the lowest
element in the high sublist). This algorithm offers guaranteed n*log(n)
performance.
Parameters:
a - the array to be sorted
Throws:
ClassCastException - if the array contains elements that are not
mutually comparable (for example, strings and integers).
sort -
Hi Gurs...
Plx help
How to get the count - number of records from a .TXT file through Oracle 8i
EMP.TXT
EMPNO ENAME
1 REENA
2 SUGU
3 RAJ
Count(*)=3
How to get this output in Oracle 8i.
Thanks in advance
Gitasql>create or replace directory TEST_DIR as 'd:\test';
Directory created.
sql>
CREATE OR REPLACE PROCEDURE rd_file
AS
v varchar2(500);
abc number;
in_file utl_file.file_type;
BEGIN
in_file :=utl_file.fopen('TEST_DIR','sample.txt','R');
abc := 0;
loop
utl_file.get_line(in_file,v);
abc := abc + 1;
end loop;
EXCEPTION
when no_data_found then
utl_file.fclose(in_file);
dbms_output.put_line(abc);
END ;
show errors;
Procedure created.
No errors
sql>
begin
rd_file;
end;
4
PL/SQL procedure successfully completed
Message was edited by:
jeneesh -
SQL Loader problem while loading records from txt file to database table.
I am getting following error while loading records from flat txt file into database table with the help of 'sqlldr' command. I have executed catldr.sql from RDBMS folder but it is still showing same error. I am setting DIRECT = TRUE while issuing sqlldr command. If I try with DIRECT = FALSE then it works fine. Database is Oracle 8i.
SQL*Loader-951: Error calling once/load initialization
ORA-24329: invalid character set identifier
F1 Please.Hello,
Direct path load, can only be used with SQL*Loader and Database have the same version.
Care to tell the database version and sql*loader version you are using.
-Sri -
How to make this faster?? read millions of record from txt file
Hi there,
I got an issue. There is a txt file contains 2 million records, I also got another file contains over 10000 numbers. Now, I need to compare this 10000 numbers with that 2 million records if any records contains a number which belongs to 10000 number set, i retrieve this record and keep it. later on, when i finish the comparison i'll write all the result records into a txt file.
What kind of data structure shall i use to keep the records and numbers? how to make the comparison quicker? Any idea will do!
Thanks!if i were to do it, i will insert bout the records into the db. then do an sql statement on the two tables to get the results. Then get the rs and output it to another text file.
just my opinion. not sure if this is faster.
Message was edited by:
clarenceloh -
Generate target/out file with header record as Record Count ?
Hi Kareem, Please try the below approach. Pipeline 1: Load actual data(without header with record count) from source to target. Let say your file name is intermediate1.dat Pipeline 2: Take the target from pipeline 1 as source and create the header with count of source file using an aggregator. The filename of target for pipeline 2 will be your final file(header and detail data). Pipeline 3: Take the target of pipeline 1 again and do 1-to-1 load to the target file of second pipeline. In session properties, dont forget to tick the check box append if exists for the third pipeline target. There may be other simple approaches also. If you have no time in hand try the above approach. Let me know if you find any issues. Thanks,Deeshan.
Generate target/out file with header record as Record Count ? Out file:---------------------------Record Count :2000 Coulmn1, Column2...Data, data........
-
How to generate .txt file from data in internal table
Hi I am using the program below to load .txt file into SAP table.
I am moving the records from a .txt file into internal table final and then into ZOUT_CCFOBS table.
How do I load records from internal table final back to another .txt file with the same layout? Pls advice.
REPORT ZOUP_LOAD_CCF_OBS.
TABLES: ZOUT_CCFOBS.
TYPES: BEGIN OF tline, "structure to store a line of each row
line(1000) TYPE c,
END OF tline.
TYPES: BEGIN OF i_split, "structure to store split record of each row
t_ZOTFACIL(100) TYPE c,
t_ZOTCCF(8) TYPE c,
t_ZOTOBSCAT(100) TYPE c,
END OF i_split.
DATA: itab TYPE TABLE OF tline WITH HEADER LINE.
DATA: idat TYPE TABLE OF i_split WITH HEADER LINE.
DATA: final TYPE STANDARD TABLE OF ZOUT_CCFOBS WITH HEADER LINE.
DATA: file_str TYPE string.
DATA: c_fnh_mask TYPE dxfields-filemask VALUE '.',
c_search_dir TYPE dxfields-longpath.
SELECTION-SCREEN BEGIN OF BLOCK a1 WITH FRAME TITLE text-001.
PARAMETERS p_file LIKE rlgrap-filename. "file location
SELECTION-SCREEN END OF BLOCK a1.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
PERFORM f4_dxfilename USING p_file.
START-OF-SELECTION.
Download data from application server
PERFORM download_data.
file_str = p_file.
LOOP AT itab.
CLEAR idat.
this will split the line at every delimeter into single field
SPLIT itab-line AT ',' INTO idat-t_ZOTFACIL
idat-t_ZOTCCF
idat-t_ZOTOBSCAT.
APPEND idat.
ENDLOOP.
copying the internal table into final table which compatible with table tcurr
LOOP AT idat.
final-ZOTFACIL = idat-t_ZOTFACIL.
final-ZOTCCF = idat-t_ZOTCCF.
final-ZOTOBSCAT = idat-t_ZOTOBSCAT.
APPEND final.
ENDLOOP.
LOOP AT final.
MODIFY ZOUT_CCFOBS FROM final.
IF sy-subrc EQ 0.
MESSAGE S001(ZCURR).
ELSE.
MESSAGE A000(ZCURR).
ENDIF.
ENDLOOP.
FORM f4_dxfilename USING p_file.
addition TAICK 15/07/2008.
*maintain application server default search path.
IF sy-sysid = 'BWP'.
c_search_dir = '//rdmsbw/prd/data/output/all'.
ELSEIF sy-sysid = 'BWQ'.
c_search_dir = '//rdmsbw/uat/data/output/all'.
ELSEIF sy-sysid = 'BWD'.
IF sy-mandt = '900'.
c_search_dir = '//rdmsbw/sit/data/output/all'.
ELSE.
c_search_dir = '//rdmsbw/dev/data/output/all'.
ENDIF.
ENDIF.
DATA: wa_file LIKE dxfields-longpath.
CLEAR: wa_file.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
i_location_flag = 'A'
i_server = ' '
i_path = c_search_dir
filemask = c_fnh_mask
fileoperation = 'R'
IMPORTING
o_path = wa_file
EXCEPTIONS
rfc_error = 1
error_with_gui = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
p_file = wa_file.
ENDIF.
addition end TAICK 15/07/2008.
ENDFORM. " f4_dxfilename
FORM download_data .
OPEN DATASET p_file FOR INPUT IN TEXT MODE ENCODING DEFAULT.
DO.
IF sy-subrc <> 0.
exit.
ENDIF.
READ DATASET p_file INTO itab.
if sy-subrc = 0.
APPEND itab.
clear itab.
endif.
ENDDO.
CLOSE DATASET p_file.
delete itab index 1. "remove column header
ENDFORM. " download_data
Edited by: RebekahMBB on Feb 20, 2012 12:56 PMHi I am using this piece of code to download my internal table into an .xls file on my pc.
FORM Z_CONVERT_EXCEL .
"This part of code to add column name in the downloaded file.
data : begin of int_head occurs 0,
Filed1(20) type c, " Header Data
end of int_head.
int_head-Filed1 = 'ZOTOUS'.
APPEND int_head.
CLEAR int_head.
int_head-Filed1 = 'ZOTOUS'.
APPEND int_head.
CLEAR int_head.
int_head-Filed1 = 'ZOTOGCUR'.
APPEND int_head.
CLEAR int_head.
Select ZOTOUS ZOTSYORGU ZOTOGCUR from ZOUT_ORG_CURR into CORRESPONDING FIELDS OF TABLE itab.
v_filetype = '.xls'. "I just manipulate the file name using XLS file type.
v_filename = 'C:\Documents and Settings\00088592\Desktop\OUs automation\development'.
CONCATENATE v_filename v_filetype INTO lv_filename.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = lv_filename
filetype = 'ASC'
APPEND = 'X'
write_field_separator = 'X'
CONFIRM_OVERWRITE = 'X'
TABLES
data_tab = itab
FIELDNAMES = int_head
EXCEPTIONS
file_open_error = 1
file_write_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
ENDIF.
ENDFORM. "Z_CONVERT_EXCEL
As you can see the code specifies the header row separately and appends it in int_head.
What if I have 76 fields or more? I cant be specifying each like that.
Is there any other way to do this? To move the 76 field headers into int_head?
Pls help.
Thanks! -
Record Count of Lines in the Reciever Txt file
Hi,
I am Working with File to Idoc Scenarion. Where I have field "Record Count in the reciever. Where the total number of lines in the reciever file has to mapped with the field and the file to be recieved to the destination.
eg:Each Idoc that we receive, 2 lines are written out, one starts with BATHDR, the other is SECPTY.
There is also then 1 extra line, the header line. I looked at a bunch of iFiles, and it seems to be if we knew the total # of idocs for a given payment run, the total # of lines we would output is:
( ( #ofIDOCS * 2) + 1).
With this observation can you advise on the action to be taken for the out put.
Thanks ,
ManojHi,
I am Working with Idoc to File Scenarion. Where I have field "Record Count in the reciever. Where the total number of lines in the reciever file has to mapped with the field and the file to be recieved to the destination.
eg:Each Idoc that we receive, 2 lines are written out, one starts with BATHDR, the other is SECPTY.
There is also then 1 extra line, the header line. I looked at a bunch of iFiles, and it seems to be if we knew the total # of idocs for a given payment run, the total # of lines we would output is:
( ( #ofIDOCS * 2) + 1).
With this observation can you advise on the action to be taken for the out put.
Thanks ,
Manoj -
Hi,
I've been looking for ways to get the record count(number of lines) of a txt file from a OS using a Oracle procedure without having to loop into the file line by line as on UTL_FILE.GET_LINE proc. If anyone has a one way method to get the number of lines of a OS file thru PLSQL without using loops, please let me know.
I appreciate your inputs on this matter.
Thiago SantanaHi,
Simple example using external tables (I have an external directory called EXT_FILES where HR user can read and write; the test.txt file is also in this directory):
File: test.txt
1 hi
2
3 how
4
5 are
6
7
8
9
10you.External table creation:
CREATE TABLE test_ext (TEXT VARCHAR2(4000))
ORGANIZATION EXTERNAL (
TYPE oracle_loader
DEFAULT DIRECTORY EXT_FILES
ACCESS PARAMETERS (
RECORDS DELIMITED BY NEWLINE
NOBADFILE NODISCARDFILE NOLOGFILE
FIELDS TERMINATED BY '0x0A'
MISSING FIELD VALUES ARE NULL)
LOCATION ('test.txt'))
REJECT LIMIT unlimited;Test:
Connected to Oracle Database 10g Express Edition Release 10.2.0.1.0
Connected as hr
SQL> select count(*) from test_ext t;
COUNT(*)
10
SQL>Regards,
Edited by: Walter Fernández on May 11, 2009 11:35 PM - Adding line numbers to test file... -
Need a relative sequence (count of record) in an input file in ESB input fi
I am using ESB to pick up text files and pass them to a stored procedure. I have multiple variable length records in the file. I pass each record to the
output file adapter, along with the input filename. I would also like to get a relative record number for each record within the file. I use an xsd file
to convert the input to XML. The entire file is at the root level, each record is an element. Is there a way to get a relative count of each element?
Here is the xsd file:
<?xml version="1.0" encoding="UTF-8" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd"
targetNamespace="http://TargetNamespace.com/Filein"
xmlns:tns="http://TargetNamespace.com/Filein"
elementFormDefault="qualified"
attributeFormDefault="unqualified" nxsd:encoding="ASCII" nxsd:stream="chars" nxsd:version="NXSD">
<xsd:element name="Root-Element">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="C1" minOccurs="1" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="C1" type="xsd:string" nxsd:style="terminated" nxsd:terminatedBy="${eol}" nxsd:quotedBy=""">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<!--NXSDWIZ:J:\\UPLD5383.INM:-->
<!--USE-HEADER:false:-->
I need to map the relative record number to a field in the output.
Is there a function similar to the get filename that would return this value to me?
<xsl:value-of select='ehdr:getRequestHeader("/fhdr:InboundFileHeaderType/fhdr:fileName","fhdr=http://xmlns.oracle.com/pcbpel/adapter/file/;")'/>
I use this in the xsl file to get the file name .does each record start with a new line? if it does a
simple wc -l can help you. If not, you can pre
process this XML file by first removing all the new
line characters using sed and then adding new line
characters after the end tag of the xml using sed and
finally doing a wc -l . this would be a simple shell
script. Not sure if you want to use Unix shell
scripting to achieve this.The sheer nature of XML means that it does not conform to any visual formatting. i.e. An xml file containing...
<employee><empno>3</empno></employee>
is identical in XML terms to...
<employee>
<empno>3</empno>
</employee>
which is also identical in XML terms to...
<employee>
<empno>
3
</empno>
</employee>
which is also identical in XML terms to...
<employee><empno>
3
</empno></employee>
etc.
You cannot rely on the number of CR's or CR/LF's in the file to count the records. Proper XML processing should be used for such a task.
Maybe you are looking for
-
GL account for WRX - GR/IR Clearing Account
Dear All, We have a common material which will be purchased through domestic an import PO. Valuation Class is assigned for the material in OBYC for a GL account. Requirement is to have different GL account for WRX when material is purchased through d
-
Which table contains the status for WBS elemnts
Hi Experts , Could some one provide information regarding :- While we check WBS element in t-code :CJ03 for every WBS there are some status fields indicating REL / PLN etc. At the table level i m unable to find this status field. Aldready Checked in
-
Default Font in Acrobat 7 and/or Acrobat Reader 9
Anyone know how to change the Default Font in Acrobat 7 and/or Acrobat Reader 9? Whenever I open a PDF document the text defaults to a Times New Roman or basic font. Can we change the default font?
-
I'm getting wavy lines on my freeze frame
I've made a freeze frame of a shot looking through an open door. The door frame is in shot. I have added a slow zoom to the freeze frame using motion. As it zooms in the straight lines of the door frame start to go wavy. What's going on?
-
Speaker drop down menu in itunes is not there.
I have airport express and set up airtunes, but itunes does not have a drop down menu to pick which speakers to play through. There seems to be no support docs on this. The airtunes setup page makes it sound like, hey, no problem, just choose the spe