Number of records in trail files
Hi,
I have a extract group which captures the change data from many source tables and gives one kind of trail files in different sequence number.
I would like to know the number of records per table in the trail files.I am not sure whether there is any log table which holds this information?
Regards,
Azim
Dear ,
Thanks for your reply.
Could you please tell me what kind of checkpoints?
Regards,
Azim
Similar Messages
-
Determine the number of records in a file
I want to analyse record types from a large input file and so far have managed to extract different groups and created the relevant files. All I want to do now is count the number of records in each file so I can produce a report showing the different types but cannot figure out how to do this, I know it will be simple but I cannot get any command to accomplish this, help please!
in applescript, there are a few ways to count patterned text. if (as jeffrey suggests) each record is a separate line, then you can use the following:
set textContents to read "/path/to/file.txt"
count of paragraphs of textContents
if records are determined by some other process (such as a special delimiting character or phrase) you can use text items (replace the @ sign with the special character or phrase):
set textContents to read "/path/to/file.txt"
set {oldTID, my text item delimiters} to {my text item delimiters, "@"}
set theCount to count of text items of textContents
set my text item delimiters to oldTID -
Total number of records in a file
hello experts,
I am getting a file to upload the data.... This file is containing one header record one trailor record and remaining data records...
how to read all the data into one internal table along with header and tralor record.
Because i have to control record validation. In the trailer record the amount what they were giving is the total number of records along with header and trailor
can anyone guide me how to do that
SRIIf thats an excel file then you can use function module
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = p_fnam
i_begin_col = 1
i_begin_row = 1
i_end_col = 100
i_end_row = 30000
TABLES
intern = iexcel
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE: / 'EXCEL UPLOAD FAILED ', p_fnam, sy-subrc.
STOP.
ENDIF.
Instead of passing 1 in i_begin_row you, if you know how many lines the header is going to be then you can ignore those lines and pass the number of the row which has the first data record. You can hard code the header because this is giong to constant.
Just a suggestion. Hope this works for you.
Thanks.
Message was edited by:
mg s -
Number of records in a flat file
Hi All,
I have a very big file in CSV format to be loaded into BW. When I try to open it to see the number of records, it is giving me a message "File not loaded completely". When I click on OK, it is showing some records, which I presume to be the maximum limit of the excel sheet. Is there anyway I can find the total number of records in this file?
Thanks,
RPK.Hi RPK,
You can open your file with Access, there you will see all the lines. Another way if you don't have Access is to use the Notepad, there you will be able to see the number of lines using the "status bar" in the display menu.
Regards,
Philippe -
SQLEXEC on each new trail file or just on replicat start to capture current FILESEQNO?
Dear community,
I need to capture fileseqno of the trail file that replicat is processing. But I only need to capture it once without overhead of adding fileseqno column to target tables.
I clearly understand that using colmap ( usedefaults, FILESEQNO = @GETENV ("RECORD", "FILESEQNO") ) inserts fileseqno value for every record captured from logs, but what I'm trying to accomplish is to react on the event of changing fileseqno number while replicat is running.
Following application logic I actually only need to capture fileseqno of the first trail, that is processed by replicat.
What I've tried so far is using following parameters for replicat (given two tables to be replicated):
table m.EventHead,
sqlexec( id set_first_seq_no1, spname pk_replication_accounting.set_first_seq_no, params( a_fileseqno = @GETENV( "GGFILEHEADER", "FILESEQNO" ) ), afterfilter ),
filter (@coltest( set_first_seq_no1.a_fileseqno, NULL ) or @coltest( set_first_seq_no1.a_fileseqno, MISSING ) or @coltest( set_first_seq_no1.a_fileseqno, INVALID ) ),
eventactions( ignore record );
table m.EventTail,
sqlexec( id set_first_seq_no2, spname pk_replication_accounting.set_first_seq_no, params( a_fileseqno = @GETENV( "GGFILEHEADER", "FILESEQNO" ) ), afterfilter ),
filter (@coltest( set_first_seq_no2.a_fileseqno, NULL ) or @coltest( set_first_seq_no2.a_fileseqno, MISSING ) or @coltest( set_first_seq_no2.a_fileseqno, INVALID ) ),
eventactions( ignore record );
pk_replication_accounting.set_first_seq_no is defined within package as
procedure set_first_seq_no( a_fileseqno in out pls_integer );
With filter clause I've tried to instruct GG to perform SQLEXEC only for the first record captured for every table, but with no success. Stored procedure is fired multiple times upon every record in trail file.
As far as I understand standalone SQLEXEC is not capable of obtaining value of @GETENV( "GGFILEHEADER", "FILESEQNO" ), though I have not tried it yet.
Another way, that I see, is to instruct extract to add one fake record for every new trail file and then to process it within map clause with SQLEXEC. For example if SOURCEISTABLE had per table effect, then we could get our single record for every trail using dual table:
sourceistable
table dual;
Still I don't know how to achieve required behavior.
Please help, if you know some workarounds.Managed to capture current fileseqno for every replicat start with following parameters:
ignoreupdatebefores
map m.EventHead, target gg.tmp_gg_dummy, handlecollisions, colmap ( id = @GETENV ("RECORD", "FILERBA") )
sqlexec( id set_first_seq_no1, spname pk_replication_accounting.set_first_seq_no, params(a_fileseqno = @GETENV( "GGFILEHEADER", "FILESEQNO" ) ), afterfilter ),
filter (@getenv( "STATS", "TABLE", "GG.TMP_GG_DUMMY", "DML" ) = 0), insertallrecords;
map m.EventTail, target gg.tmp_gg_dummy, handlecollisions, colmap ( id = @GETENV ("RECORD", "FILERBA") )
sqlexec( id set_first_seq_no2, spname pk_replication_accounting.set_first_seq_no, params(a_fileseqno = @GETENV( "GGFILEHEADER", "FILESEQNO" ) ), afterfilter ),
filter (@getenv( "STATS", "TABLE", "GG.TMP_GG_DUMMY", "DML" ) = 0), insertallrecords;
tmp_gg_dummy is defined as the following:
create global temporary table gg.tmp_gg_dummy ( id number( 14, 0 ) ) on commit delete rows;
alter table gg.tmp_gg_dummy add constraint tmp_gg_dummy_pk primary key ( id );
Procedure is fired only once per every replicat start and report file shows the following:
From Table m.EventHead to GG.TMP_GG_DUMMY:
Stored procedure set_first_seq_no1:
attempts: 0
successful: 0
From Table m.EventTail to GG.TMP_GG_DUMMY:
# inserts: 0
# updates: 1
# deletes: 0
# discards: 0
Stored procedure set_first_seq_no2:
attempts: 1
successful: 1
though original mapping from m.EventTail has
inserts:
69
updates:
21
befores:
21
deletes:
0
discards:
0 -
Add number of records to a field
I need to load data in BW ODS from flat file and want to populate one field ROWID which will hold record numbers starting from 1 if ODS is empty. This ROWID in ODS is used as Key field. I want to populate this ROWID based on number of records in flat file.
If there are already records in ODS and say last record number is 10, next record number will be 11 and will populate rests one by one.
So first I want to read ODS table if there are any records. If empty, ROWID will be populating from record 1 and if not empty, get the last ROWID and populate from next number.
Help me with the code please?Hi,
If the select count (*) is successfull then add 1 to the count then move it to the rowid column.
SELECT COUNT(*) INTO V_COUNT FROM TABLENAME.
IF SY-SUBRC NE 0.
* If no records found then set the counter to 1.
v_count = 1.
ELSE.
* If the record is found then set the row id of the table by adding 1.
TABLENAME-ROWID = V_COUNT + 1.
ENDIF.
**If you want to insert multiple records within a loop.
LOOP AT ITAB.
* Increment the counter.
V_COUNT = V_COUNT + 1.
* Set the row id.
TABLENAME-ROWID = V_COUNT.
ENDLOOP.
Hope this helps.
Thanks
Naren -
Sun IDM 8.1.1P2: Export user records to xls file Functionality Issue
Hi All,
This is my first post in this form, please guide me to right path.
We implemented custom functionality to search user records from AD and LDAP from IDM User console. After searching the records we provided a export functionality to export resultant user records to xls file.
The issue is the number of exported user records to xls file is not same as the number of user records while search.
This functionality is working good in our Development and VALenvironments but not with the Production environment.
I checked the custom jsp file and the calling Rule from all the three environments and they are same.
From VAL and PROD server.log I see the following.
PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: PWC3991: getOutputStream() has already been called for this response
But this error message didn't stop VAL to export same number of records to xls file.
# of records serached from PROD is 16809
# of records serached from VAL is 10312
They are constant all the time.
# of records exported to xls from PROD is 168 or 1274 (It is varying, each time I export it shows different number)
# of records exported to xls from VAL is 10312 (Always same as search)
We are on Glassfish V2.1.1P8.
I checked file sizes from VAL and PROD both are same.
It would be great if any one can point me to the right direction where else I have to check for possible cause.
Thanks,
Ravi MangalagiriHi Arjun,
Thanks for responding to my post.
The search is working as expected in all 3 environments DEV,VAL and PROD.
The search and alignment performed by the Rule where as DB connection and Saving to XLS performed by the custom JSP file.
Since search is working fine I don't think any permissions issue with AD or LDAP.
Couple of things I noticed from server.log from all environments
SEVERE|sun-appserver2.1.1|javax.enterprise.system.container.web|_
ThreadID=297;_ThreadName=httpSSLWorkerThread-9084-102;_RequestID=5efa3ecb-0ec9-4695-ab51-8049257b
9d57;|StandardWrapperValve[jsp]: PWC1406: Servlet.service() for servlet jsp threw exception
java.lang.IllegalStateException: PWC3991: getOutputStream() has already been called for this resp
onse
and
WARNING|sun-appserver2.1.1|javax.enterprise.system.stream.err|_ThreadID=78;_ThreadName=Provisioner;_RequestID=531d32b0-6d9a-4
3e-bd74-0bc9478ffdae;|org.xml.sax.SAXParseException: XML document structures must start and end within the same entity.
at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
This is logging when the custom jsp is executing.
getOutputStream() has already been called for this response.
I am not sure if this is the root cause, since it is logging in DEV and VAL also.
Other things I noticed are.
Yester day I conducted 10 tests and all are taking 6 min 18 sec or 6 min 19 sec or 6 min 22 sec.
Also I noticed that the number of user records exported to xls depends on the transfer rate.
For example,
if the file download transfer rate is 1.50 KB then the user records are between 1200 to 1800 where as the search user records are 16590.
if the file download transfer rate is 800 B then the user records are between 200 to 600 where as the search user records are 16590.
Not sure where to check this time value(attribute) 6 min 18 sec..
Please provide me some info where else I need to check.
Thanks,
Ravi. -
FM for reading total record in flat file
Hi,
Do we any function module which can tell me about number of record in flat file.
I want only FM name!!
Thanks for your reply!! but File is only there in Application server.
Thanks in advance.
Message was edited by: Vipin NagpalHi,
then you need to call the unix command (if your application server is Unix)
<b>wc -l fielname</b>
data: unixcom like rlgrap-filename.
unixcom = 'wc -l fielname'
data: begin of tabl occurs 500,
line(400),
end of tabl.
data: lines type i.
call 'SYSTEM' id 'COMMAND' field unixcom
id 'TAB' field tabl[].
loop at tabl.
write:/01 tabl-line.
endloop.
Regards
vijay -
How count number of item records in a File: Idoc to File scenario
Hi All,
I am configuring an IDOC to File scenario.
Once all the IDOC data is dumped on a File, I need to calculate the number of Item records in this file and write this number at the end of the trailer record in the file.
Is theer a way to calculate the item data records(or say number of lines in the file) in the message mapping area. Or any other simple way to do it.
Appreciate your help on same.
Thanks
Shirinhi,
Use the count function for ITEM node the assign this count value to the receiver field , keep the ITEM context to header!
Thanks,
Vijaya. -
Modify Record Number in a Random Access File
Hi Does anyone know if I can modify the record number in the random access file hardware.dat for each hardware record each time and update it in hardware.dat to display it? Also why does it say "Record does not exist" if I modify the record number for a hardware and try to update it but could not find that record?
Here is the code below:
// Exercise 14.11: HardwareRecord.java
package org.egan; // packaged for reuse
public class HardwareRecord
private int recordNumber;
private String toolName;
private int quantity;
private double cost;
// no-argument constructor calls other constructor with default values
public HardwareRecord()
this(0,"",0,0.0); // call four-argument constructor
} // end no-argument HardwareRecord constructor
// initialize a record
public HardwareRecord(int number, String tool, int amount, double price)
setRecordNumber(number);
setToolName(tool);
setQuantity(amount);
setCost(price);
} // end four-argument HardwareRecord constructor
// set record number
public void setRecordNumber(int number)
recordNumber = number;
} // end method setRecordNumber
// get record number
public int getRecordNumber()
return recordNumber;
} // end method getRecordNumber
// set tool name
public void setToolName(String tool)
toolName = tool;
} // end method setToolName
// get tool name
public String getToolName()
return toolName;
} // end method getToolName
// set quantity
public void setQuantity(int amount)
quantity = amount;
} // end method setQuantity
// get quantity
public int getQuantity()
return quantity;
} // end method getQuantity
// set cost
public void setCost(double price)
cost = price;
} // end method setCost
// get cost
public double getCost()
return cost;
} // end method getCost
} // end class HardwareRecord-------------------------------------------------------------------------------------------------
// Exercise 14.11: RandomAccessHardwareRecord.java
// Subclass of HardwareRecord for random-access file programs.
package org.egan; // package for reuse
import java.io.RandomAccessFile;
import java.io.IOException;
public class RandomAccessHardwareRecord extends HardwareRecord
public static final int SIZE = 46;
// no-argument constructor calls other constructor with default values
public RandomAccessHardwareRecord()
this(0,"",0,0.0);
} // end no-argument RandomAccessHardwareRecord constructor
// initialize a RandomAccessHardwareRecord
public RandomAccessHardwareRecord(int number, String tool, int amount, double price)
super(number,tool,amount,price);
} // end four-argument RandomAccessHardwareRecord constructor
// read a record from a specified RandomAccessFile
public void read(RandomAccessFile file) throws IOException
setRecordNumber(file.readInt());
setToolName(readName(file));
setQuantity(file.readInt());
setCost(file.readDouble());
} // end method read
// ensure that name is proper length
private String readName(RandomAccessFile file) throws IOException
char name[] = new char[15], temp;
for(int count = 0; count < name.length; count++)
temp = file.readChar();
name[count] = temp;
} // end for
return new String(name).replace('\0',' ');
} // end method readName
// write a record to specified RandomAccessFile
public void write(RandomAccessFile file) throws IOException
file.writeInt(getRecordNumber());
writeName(file, getToolName());
file.writeInt(getQuantity());
file.writeDouble(getCost());
} // end method write
// write a name to file; maximum of 15 characters
private void writeName(RandomAccessFile file, String name) throws IOException
StringBuffer buffer = null;
if (name != null)
buffer = new StringBuffer(name);
else
buffer = new StringBuffer(15);
buffer.setLength(15);
file.writeChars(buffer.toString());
} // end method writeName
} // end RandomAccessHardwareRecord-------------------------------------------------------------------------------------------------
// Exercise 14.11: CreateRandomFile.java
// creates random-access file by writing 100 empty records to disk.
import java.io.IOException;
import java.io.RandomAccessFile;
import org.egan.RandomAccessHardwareRecord;
public class CreateRandomFile
private static final int NUMBER_RECORDS = 100;
// enable user to select file to open
public void createFile()
RandomAccessFile file = null;
try // open file for reading and writing
file = new RandomAccessFile("hardware.dat","rw");
RandomAccessHardwareRecord blankRecord = new RandomAccessHardwareRecord();
// write 100 blank records
for (int count = 0; count < NUMBER_RECORDS; count++)
blankRecord.write(file);
// display message that file was created
System.out.println("Created file hardware.dat.");
System.exit(0); // terminate program
} // end try
catch (IOException ioException)
System.err.println("Error processing file.");
System.exit(1);
} // end catch
finally
try
if (file != null)
file.close(); // close file
} // end try
catch (IOException ioException)
System.err.println("Error closing file.");
System.exit(1);
} // end catch
} // end finally
} // end method createFile
} // end class CreateRandomFile-------------------------------------------------------------------------------------------------
// Exercise 14.11: CreateRandomFileTest.java
// Testing class CreateRandomFile
public class CreateRandomFileTest
// main method begins program execution
public static void main( String args[] )
CreateRandomFile application = new CreateRandomFile();
application.createFile();
} // end main
} // end class CreateRandomFileTest-------------------------------------------------------------------------------------------------
// Exercise 14.11: MenuOption.java
// Defines an enum type for the hardware credit inquiry program's options.
public enum MenuOption
// declare contents of enum type
PRINT(1),
UPDATE(2),
NEW(3),
DELETE(4),
END(5);
private final int value; // current menu option
MenuOption(int valueOption)
value = valueOption;
} // end MenuOptions enum constructor
public int getValue()
return value;
} // end method getValue
} // end enum MenuOption-------------------------------------------------------------------------------------------------
// Exercise 14.11: FileEditor.java
// This class declares methods that manipulate hardware account records
// in a random access file.
import java.io.EOFException;
import java.io.File;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.Scanner;
import org.egan.RandomAccessHardwareRecord;
public class FileEditor
RandomAccessFile file; // reference to the file
Scanner input = new Scanner(System.in);
// open the file
public FileEditor(String fileName) throws IOException
file = new RandomAccessFile(fileName, "rw");
} // end FileEditor constructor
// close the file
public void closeFile() throws IOException
if (file != null)
file.close();
} // end method closeFile
// get a record from the file
public RandomAccessHardwareRecord getRecord(int recordNumber)
throws IllegalArgumentException, NumberFormatException, IOException
RandomAccessHardwareRecord record = new RandomAccessHardwareRecord();
if (recordNumber < 1 || recordNumber > 100)
throw new IllegalArgumentException("Out of range");
// seek appropriate record in a file
file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
record.read(file);
return record;
} // end method getRecord
// update record tool name in file
public void updateRecordToolName(int recordNumber, String newToolName)
throws IllegalArgumentException, IOException
RandomAccessHardwareRecord record = getRecord(recordNumber);
if (record.getRecordNumber() == 0)
throw new IllegalArgumentException("Record does not exist");
// seek appropriate record in file
file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
record.setToolName(newToolName);
record = new RandomAccessHardwareRecord(
record.getRecordNumber(), record.getToolName(), record.getQuantity(), record.getCost());
record.write(file); // write updated record to file
} // end method updateRecordToolName
// update record in file
public void updateRecordQuantity(int recordNumber, int newQuantity)
throws IllegalArgumentException, IOException
RandomAccessHardwareRecord record = getRecord(recordNumber);
if (record.getRecordNumber() == 0)
throw new IllegalArgumentException("Record does not exist");
// seek appropriate record in file
file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
record.setQuantity(newQuantity);
record = new RandomAccessHardwareRecord(
record.getRecordNumber(), record.getToolName(), record.getQuantity(), record.getCost());
record.write(file); // write updated record to file
} // end method updateRecordQuantity
// update record in file
public void updateRecordCost(int recordNumber, double newCost)
throws IllegalArgumentException, IOException
RandomAccessHardwareRecord record = getRecord(recordNumber);
if (record.getRecordNumber() == 0)
throw new IllegalArgumentException("Record does not exist");
// seek appropriate record in file
file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
record.setCost(newCost);
record = new RandomAccessHardwareRecord(
record.getRecordNumber(), record.getToolName(), record.getQuantity(), record.getCost());
record.write(file); // write updated record to file
} // end method updateRecordCost
// add record to file
public void newRecord(int recordNumber, String toolName, int quantity, double cost)
throws IllegalArgumentException, IOException
RandomAccessHardwareRecord record = getRecord(recordNumber);
if (record.getRecordNumber() != 0)
throw new IllegalArgumentException("Record already exists");
// seek appropriate record in file
file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
record = new RandomAccessHardwareRecord(recordNumber, toolName, quantity, cost);
record.write(file); // write record to file
} // end method newRecord
// delete record from file
public void deleteRecord(int recordNumber) throws IllegalArgumentException, IOException
RandomAccessHardwareRecord record = getRecord(recordNumber);
if (record.getRecordNumber() == 0)
throw new IllegalArgumentException("Account does not exist");
// seek appropriate record in file
file.seek((recordNumber - 1) * RandomAccessHardwareRecord.SIZE);
// create a blank record to write to the file
record = new RandomAccessHardwareRecord();
record.write(file);
} // end method deleteRecord
// read and display records
public void readRecords()
RandomAccessHardwareRecord record = new RandomAccessHardwareRecord();
System.out.printf("%-10s%-15s%-15s%10s\n","Record","Tool Name","Quantity","Cost");
try // read a record and display
file.seek(0);
while (true)
do
record.read(file);
while (record.getRecordNumber() == 0);
// display record contents
System.out.printf("%-10d%-15s%-15d%10.2f\n",record.getRecordNumber(),
record.getToolName(), record.getQuantity(), record.getCost());
} // end while
} // end try
catch (EOFException eofException) // close file
return; // end of file was reached
} // end catch
catch (IOException ioException)
System.err.println("Error reading file.");
System.exit(1);
} // end catch
} // end method readRecords
} // end class FileEditor-------------------------------------------------------------------------------------------------
// Exercise 14.11: TransactionProcessor.java
// A transaction processing program using random-access files.
import java.io.IOException;
import java.util.NoSuchElementException;
import java.util.Scanner;
import org.egan.RandomAccessHardwareRecord;
public class TransactionProcessor
private FileEditor dataFile;
private RandomAccessHardwareRecord record;
private MenuOption choices[] = {MenuOption.PRINT, MenuOption.UPDATE, MenuOption.NEW,
MenuOption.DELETE, MenuOption.END};
private Scanner input = new Scanner(System.in);
// get the file name and open the file
private boolean openFile()
try // attempt to open file
// call the helper method to open the file
dataFile = new FileEditor("hardware.dat");
} // end try
catch (IOException ioException)
System.err.println("Error opening file.");
return false;
} // end catch
return true;
} // end method openFile
// close file and terminate application
private void closeFile()
try // close file
dataFile.closeFile();
} // end try
catch (IOException ioException)
System.err.println("Error closing file.");
System.exit(1);
} // end catch
} // end method closeFile
// create, update or delete the record
private void performAction(MenuOption action)
int recordNumber = 0; // record number of record
String toolName; // tool name of the hardware instrument
int quantity; // total amount of items
double cost; // hareware tool price
int choice; // choose an update option
int newRecordNumber; // the updated record number
String newToolName; // the updated tool name
int newQuantity; // the updated quantity
double newCost; // the updated cost
try // attempt to manipulate files based on option selected
switch(action) // switch based on option selected
case PRINT:
System.out.println();
dataFile.readRecords();
break;
case NEW:
System.out.printf("\n%s%s\n%s\n%s","Enter record number,",
"tool name, quantity, and cost.","(Record number must be 1 - 100)","? ");
recordNumber = input.nextInt(); // read record number
toolName = input.next(); // read tool name
quantity = input.nextInt(); // read quantity
cost = input.nextDouble(); // read cost
dataFile.newRecord(recordNumber, toolName, quantity, cost); // create new record
break;
case UPDATE:
System.out.print("\nEnter record number to update (1 - 100): ");
recordNumber = input.nextInt();
record = dataFile.getRecord(recordNumber);
if (record.getRecordNumber() == 0)
System.out.println("Record does not exist.");
else
// display record contents
System.out.printf("%-10d%-12s%-12d%10.2f\n\n", record.getRecordNumber(),
record.getToolName(), record.getQuantity(), record.getCost());
System.out.printf("%s%s","\nEnter 1 to update tool name, ",
"2 to update quantity, or 3 to update cost : ");
choice = input.nextInt();
if (choice == 1)
System.out.print("Enter new record tool name : ");
newToolName = input.next();
dataFile.updateRecordToolName(recordNumber,newToolName); // update record
// tool name
// retrieve updated record
record = dataFile.getRecord(recordNumber);
// display updated record
System.out.printf("%-10d%-12s%-12d%10.2f\n", record.getRecordNumber(),
record.getToolName(), record.getQuantity(), record.getCost());
else if (choice == 2)
System.out.print("Enter new record quantity : ");
newQuantity = input.nextInt();
dataFile.updateRecordQuantity(recordNumber,newQuantity); // update record
// quantity
// retrieve updated record
record = dataFile.getRecord(recordNumber);
// display updated record
System.out.printf("%-10d%-12s%-12d%10.2f\n", record.getRecordNumber(),
record.getToolName(), record.getQuantity(), record.getCost());
else if (choice == 3)
System.out.print("Enter new record cost : ");
newCost = input.nextDouble();
dataFile.updateRecordCost(recordNumber,newCost); // update record cost
// retrieve updated record
record = dataFile.getRecord(recordNumber);
// display updated record
System.out.printf("%-10d%-12s%-12d%10.2f\n", record.getRecordNumber(),
record.getToolName(), record.getQuantity(), record.getCost());
} // end else
break;
case DELETE:
System.out.print("\nEnter an account to delete ( 1 - 100): ");
recordNumber = input.nextInt();
dataFile.deleteRecord(recordNumber); // delete record
break;
default:
System.out.println("Invalid action.");
break;
} // end switch
} // end try
catch (NumberFormatException format)
System.err.println("Bad input.");
} // end catch
catch (IllegalArgumentException badRecord)
System.err.println(badRecord.getMessage());
} // end catch
catch (IOException ioException)
System.err.println("Error writing to the file.");
} // end catch
catch (NoSuchElementException elementException)
System.err.println("Invalid input. Please try again.");
input.nextLine();
} // end catch
} // end method performAction
// enable user to input menu choice
private MenuOption enterChoice()
int menuChoice = 1;
// display available options
System.out.printf("\n%s\n%s\n%s\n%s\n%s\n%s","Enter your choice",
"1 - List hardware records", "2 - Update a hardware record",
"3 - Add a new hardware record", "4 - Delete a hardware record", "5 - End program\n?");
try
menuChoice = input.nextInt();
catch (NoSuchElementException elementException)
System.err.println("Invalid input.");
System.exit(1);
} // end catch
return choices[menuChoice - 1]; // return choice from user
} // end enterChoice
public void processRequests()
openFile();
// get user's request
MenuOption choice = enterChoice();
while (choice != MenuOption.END)
performAction(choice);
choice = enterChoice();
} // end while
closeFile();
} // end method processRequests
} // end class TransactionProcessor-------------------------------------------------------------------------------------------------
// Exercise 14.11: TransactionProcessorTest.java
// Testing the transaction processor.
public class TransactionProcessorTest
public static void main(String args[])
TransactionProcessor application = new TransactionProcessor();
application.processRequests();
} // end main
} // end class TransactionProcessorTest-------------------------------------------------------------------------------------------------
Below is the sample data to be entered into the random input file hardware.dat :
Record Tool Quantity Cost
Number Name
3 Sander 18 35.99
19 Hammer 128 10.00
26 Jigsaw 16 14.25
39 Mower 10 79.50
56 Saw 8 89.99
76 Screwdriver 236 4.99
81 Sledgehammer 32 19.75
88 Wrench 65 6.48Message was edited by:
egan128
Message was edited by:
egan128
Message was edited by:
egan128Hi Does anyone know if I can modify the record number
in the random access file hardware.dat for each
hardware record each time and update it in
hardware.dat to display it?If the "record number" is data that is stored in the file, then you can modify it. More precisely: it is possible to modify it.
The rest of the question had too many incompatible verbs for me to understand it.
Also why does it say
"Record does not exist" if I modify the record number
for a hardware and try to update it but could not
find that record?"Record does not exist" is a fairly reasonable error message for the situation where a program looks for a record but cannot find it. Are you asking why that particular lump of code actually does that?
(One thousand lines of code removed) -
Syndicator:Restricting Number of records in a output file
Is there any mechanism by which i could restrict the number of records syndicated to a single output file ?.
Currently the only option seems to be output all records(matching certain criteria) or a single record to XML file/s.Hi,
You can restrict the search based on the search parameters.
If you want to syndiacte all the data in single XML file the in destination items tab ,
Step 1. Need to select the "Repetable XML Node" for the Main node.
Step 2. In Item Mapping tab Map the Main Table with main node for which you have set the indicator in Step 1.
Hope, I answered you.
Regards,
Nitin Deshpande -
GG Extract generates enormous number of trail files when transfers large blob
Hello experts
In working GG environment we tried to transfer large blob about 400MB - extract began to generate enormous number of trail files(thousands files) with no error messages.
We played with trail file size - increased up to 1GB but result was same.
Can you help with that issue?
Hope it is known issue
thanks in advance
VladimirVeera
Classic mode.
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0
OGG 12.1.2.0.0
Linux, x64
Raj,
We have the application that put data into DB and I suspect it can send data in smaller chunks.
Can we check in DB how it uses dbms_lob.write?
regards
Vladimir -
How to add the records of 2 internal table records into one file
hello experts,
My scenario is...
I am retrieving the data for the for the credit, debit and trailer records of the customer into 3 different internal tables and finally i have to append all those records into one file first debit records then credit records finally the trailer record.... how to do that can anyone give some idea plzzzzzzzzz..
Plz its bit urgent..
Thanks a lot for your anticipation
SRIHello,
Do like this.
" Assume u have three itab.
"Itab1 - debit
"Itab2 - credit
"Itab3 - Credit.
REPORT ZV_TEST_SERVER .
*PARAMETERS: P_FILE TYPE STRING."RLGRAP-FILENAME.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = P_FILE
* FILETYPE = 'ASC'
APPEND = 'X' " Check here
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = ITAB1
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = P_FILE
* FILETYPE = 'ASC'
APPEND = 'X' " Check here
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = ITAB2 " Check here
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = P_FILE
* FILETYPE = 'ASC'
APPEND = 'X' " Check here
* WRITE_FIELD_SEPARATOR = ' '
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = ITAB3 " Check here
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
If useful reward.
Vasanth -
Sqlldr error510 Physical record in data file is longer than the max 1048576
SQL*Loader: Release 10.2.0.2.0 - Production on Fri Sep 21 10:15:31 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Control File: /apps/towin_p/bin/BestNetwork.CTL
Data File: /work/towin_p/MyData.dat
Bad File: /apps/towin_p/bin/BestNetwork.BAD
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 50
Continuation: none specified
Path used: Direct
Load is UNRECOVERABLE; invalidation redo is produced.
Table "BN_ADM"."DWI_USAGE_DETAIL", loaded from every logical record.
Insert option in effect for this table: APPEND
TRAILING NULLCOLS option in effect
Column Name Position Len Term Encl Datatype
USAGE_DETAIL_DT FIRST * , DATE MM/DD/YYYY HH24:MI:SS
UNIQUE_KEY SEQUENCE (MAX, 1)
LOAD_DT SYSDATE
USAGE_DETAIL_KEY NEXT * , CHARACTER
RATE_AREA_KEY NEXT * , CHARACTER
UNIT_OF_MEASURE_KEY NEXT * , CHARACTER
CALL_TERMINATION_REASON_KEY NEXT * , CHARACTER
RATE_PLAN_KEY NEXT * , CHARACTER
CHANNEL_KEY NEXT * , CHARACTER
SERIALIZED_ITEM_KEY NEXT * , CHARACTER
HOME_CARRIER_KEY NEXT * , CHARACTER
SERVING_CARRIER_KEY NEXT * , CHARACTER
ORIGINATING_CELL_SITE_KEY NEXT * , CHARACTER
TERMINATING_CELL_SITE_KEY NEXT * , CHARACTER
CALL_DIRECTION_KEY NEXT * , CHARACTER
SUBSCRIBER_LOCATION_KEY NEXT * , CHARACTER
OTHER_PARTY_LOCATION_KEY NEXT * , CHARACTER
USAGE_PEAK_TYPE_KEY NEXT * , CHARACTER
DAY_OF_WEEK_KEY NEXT * , CHARACTER
FEATURE_KEY NEXT * , CHARACTER
WIS_PROVIDER_KEY NEXT * , CHARACTER
SUBSCRIBER_KEY NEXT * , CHARACTER
SUBSCRIBER_ID NEXT * , CHARACTER
SPECIAL_NUMBER_KEY NEXT * , CHARACTER
TOLL_TYPE_KEY NEXT * , CHARACTER
BILL_DT NEXT * , DATE MM/DD/YYYY HH24:MI:SS
BILLING_CYCLE_KEY NEXT * , CHARACTER
MESSAGE_SWITCH_ID NEXT * , CHARACTER
MESSAGE_TYPE NEXT * , CHARACTER
ORIGINATING_CELL_SITE_CD NEXT * , CHARACTER
TERMINATING_CELL_SITE_CD NEXT * , CHARACTER
CALL_ACTION_CODE NEXT * , CHARACTER
USAGE_SECONDS NEXT * , CHARACTER
SUBSCRIBER_PHONE_NO NEXT * , CHARACTER
OTHER_PARTY_PHONE_NO NEXT * , CHARACTER
BILLED_IND NEXT * , CHARACTER
NO_USERS_IN_CALL NEXT * , CHARACTER
DAP_NO_OF_DSAS_USED NEXT * , CHARACTER
USAGE_SOURCE NEXT * , CHARACTER
SOURCE_LOAD_DT NEXT * , DATE MM/DD/YYYY HH24:MI:SS
SOURCE_UPDATE_DT NEXT * , DATE MM/DD/YYYY HH24:MI:SS
RATE_PLAN_ID NEXT * , CHARACTER
NETWORK_ELEMENT_KEY NEXT * , CHARACTER
SQL string for column : "-2"
SQL*Loader-510: Physical record in data file (/work/towin_p/MyData.dat) is longer than the maximum(1048576)
SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
Table "BN_ADM"."DWI_USAGE_DETAIL":
0 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Date conversion cache disabled due to overflow (default size: 1000)
Bind array size not used in direct path.
Column array rows : 5000
Stream buffer bytes: 256000
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 7000382
Total logical records rejected: 0
Total logical records discarded: 0
Total stream buffers loaded by SQL*Loader main thread: 1666
Total stream buffers loaded by SQL*Loader load thread: 4996
Run began on Fri Sep 21 10:15:31 2007
Run ended on Fri Sep 21 10:27:14 2007
Elapsed time was: 00:11:43.56
CPU time was: 00:05:36.81What options are you using on the CTL file? How does your data file looks like (e.g. One line per record, one line only)?
-
How to find the number of records per months in cube
Hi,
how to find the number of records per months for my all cubes?
Can i use the ListCube transaction to find totl number f records per cube monthwise ?
JimmyHi,
Here is a program to generate no of records and list of ODS and Cubes in Active version.Schedule this program in background and create a cube to load this information and schedule to the data from the file generated by the program. Schedule this all per you requirement.
1.Copy the code into your Z<programname> from Se38.
2.change the FILENAME in CALL FUNCTION 'GUI_DOWNLOAD' in the program to the location from where you can pick the information to load data to cube(eg Application server).
3.Save program.
4.Schedule the program in background as required
5.Create cube with infoobjects to hold no of records and Infoprovider name
6.Load this cube based on event after the program job is done.
Hence you can report on this cube to see no of records in CUBE or ODS in your box.
Please find the code below.
Cheers,
Kavitha Kamesh.
types: begin of itabs ,
tabname type dd02l-tabname,
end of itabs.
data: itab type itabs occurs 0 with header line.
data: counter type i.
data: begin of itab1 occurs 0,
tabname type dd02l-tabname,
counter type i,
end of itab1.
DATA: ITABTABNAME TYPE STRING.
DATA: LENGTH TYPE I.
DATA: OBJECT(30).
data: str(6) type c.
select tabname from dd02l into table itab where ( tabname LIKE '/BIC/F%' or tabname LIKE '/BIC/A%00' )
and TABCLASS = 'TRANSP' and AS4LOCAL = 'A'.
loop at itab.
select count(*) from (itab-tabname) into counter.
str = itab-tabname.
if str = '/BIC/F'.
LENGTH = STRLEN( ITAB-TABNAME ).
SHIFT itab-tabname BY 6 PLACES LEFT.
ELSEIf str = '/BIC/A'.
SHIFT itab-tabname BY 6 PLACES LEFT.
LENGTH = STRLEN( ITAB-TABNAME ).
LENGTH = LENGTH - 2.
endif.
itab1-tabname = itab-tabname(LENGTH).
append itab1.
itab1-counter = counter.
clear itab-tabname.
clear: COUNTER.
endloop.
*********** itab1
loop at itab1.
write:/ itab1-tabname, itab1-counter.
endloop.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
* BIN_FILESIZE =
FILENAME = 'c:records.xls'
FILETYPE = 'ASC'
* APPEND = ' '
WRITE_FIELD_SEPARATOR = ','
* HEADER = '00'
* TRUNC_TRAILING_BLANKS = ' '
* WRITE_LF = 'X'
* COL_SELECT = ' '
* COL_SELECT_MASK = ' '
* DAT_MODE = ' '
* CONFIRM_OVERWRITE = ' '
* NO_AUTH_CHECK = ' '
* CODEPAGE = ' '
* IGNORE_CERR = ABAP_TRUE
* REPLACEMENT = '#'
* WRITE_BOM = ' '
* TRUNC_TRAILING_BLANKS_EOL = 'X'
* WK1_N_FORMAT = ' '
* WK1_N_SIZE = ' '
* WK1_T_FORMAT = ' '
* WK1_T_SIZE = ' '
* IMPORTING
* FILELENGTH =
TABLES
DATA_TAB = itab1
* FIELDNAMES =
* EXCEPTIONS
* FILE_WRITE_ERROR = 1
* NO_BATCH = 2
* GUI_REFUSE_FILETRANSFER = 3
* INVALID_TYPE = 4
* NO_AUTHORITY = 5
* UNKNOWN_ERROR = 6
* HEADER_NOT_ALLOWED = 7
* SEPARATOR_NOT_ALLOWED = 8
* FILESIZE_NOT_ALLOWED = 9
* HEADER_TOO_LONG = 10
* DP_ERROR_CREATE = 11
* DP_ERROR_SEND = 12
* DP_ERROR_WRITE = 13
* UNKNOWN_DP_ERROR = 14
* ACCESS_DENIED = 15
* DP_OUT_OF_MEMORY = 16
* DISK_FULL = 17
* DP_TIMEOUT = 18
* FILE_NOT_FOUND = 19
* DATAPROVIDER_EXCEPTION = 20
* CONTROL_FLUSH_ERROR = 21
* OTHERS = 22
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Maybe you are looking for
-
Want to direct iphoto back to original data
I have my photo library on an external hard drive. Photos from camera were downloaded when external had been unplugged. iphoto created a new folder with the same name as the original and loaded the new downloaded pics into it. When opening iphoto, i
-
I'm pretty new to this, so I appreciate any help in advance. I have imported a clip. I can see it and hear it fine. I've made in & out edit points and can drag it around (copy it etc.) on the timeline. But here's the odd thing... I can hear it when t
-
Hi, I need some advice on the following: We are having XI 3.0, ECC 5.0 and also have GIS Server (Gentran). We need to use these servers to convert the data from XML to IDOC (inbound to sap) as well as to XML from IDOC (outbound). We came to know GI
-
Hey, I just purchased the new iPhone 6 16GB.upgrade jump T-mobile not paid in full $700.Nevertheless, why do I keeping getting a message about storage full? And it says...Go to setting and manage storage with iCloud. I have deleted most of the app, p
-
MacBook transport monitor error -4960?
I've been using my MacBook with Palm Zire 31 and hotsync for some time and all of a sudden I get, and can't get rid of, "transport monitor error -4960." I've read all kinds of solutions in this forum and none work. I've reinstalled, deleted and rei