Convert Mainframe Packed Decimal to Oralce Number Format

Dear all,
I am having a file in which amount fields are given in a Packed Decimal format. Can anyone suggest me how I can read this data element from the file and convert it into Oracle Number datatype.
File is a fixed length. All the amount fields are given in Packed Decimal Format and rest of the fields are given in text format.
Thanks and regards
Nagasayan Puppala

Hi,
Firstly thanks for your reply.
Actually I am not using SQL Loader to load data from
a flat file to Oracle table. I am writing a custom
program that reads the file and populates the oracle
table. I'll put aside the question of 'why' you'd want to do that. SQL*Loader's singular purpose in life is to load flat files of data into Oracle DB. Sometimes there is a reason for reinventing the wheel.
How does your program communicate with the Oracle DB? If utilizing ESQL and Pro*Cobol (or Pro*<whatever> ) you will have read the data into a variable of some type in you host language. The variable of the host variable to hold the value (if you did a 'select from' that table) would be the correct target type for an insert statement. Whatever host language type conversion is available bewteen those two types ( if they are different at all ) is all that is needed. The precompilers have converters between certain native host and internal Oracle types built-in. It is how you get any data between the two systems. This is only a problem if the host language has no converter between the numeric types (if differnet.). When you read from the flat file are you reading it into a native packed decimal in the host language?
ODBC/JDBC similar strategy..... cast conversion between the native type that Oracle wants and the one into which your custom program reads it into.
So I want to know whether there are any Oracle
utility programs that will convert the packed decimal
to a oracle number format or not.There are Oracle routines that convert into the native Oracle DB formats. There are implicitly available through the normally utilized interfaces to OCI ( ESQL and ODBC/JDBC ) . There are none decoupled from those interfaces though (that I know of).
There are no standalone programs that mutate a flat file into another flat file that then could be loaded. That's is typically slower and utilzes more space than most customers want than just directly inputing the data into Oracle DB.
Message was edited by:
lytaylor

Similar Messages

  • Long / double value convertion to Packed Decimal

    Hi,
    Could anybody tell me how to convert a long / double value to Packed Decimal (AS400) ?
    Thanks,
    Probir

    Now I'm writing this value in a flat file by
    FileOutputStream and sending to mainframe through FTP.
    But the mainframe people said it's not converted into
    packed decimal. Is it the right way to convert ??When you say "mainframe" I assume you are referring to a machine that uses EBCDIC. Java, even on the iSeries, uses Unicode and not EBCDIC, so when you FTP anything to the mainframe it will go through an ASCII-to-EBCDIC conversion. You want this to happen for text but you don't want it to happen for packed decimals; your carefully-constructed x'12' x'3f' bytes will be dutifully converted into EBCDIC garbage.
    FTP of an iSeries file (in the QSYS.LIB file system) to a mainframe is trivial because both client and server use EBCDIC, so there are no conversion issues. So if you could do it that way, you definitely should. Otherwise you are going to have to take your packed decimal data and replace it by the bytes that would be translated into it if it were in EBCDIC. The translation table QEBCDIC in library QSYS shows you how it does that, so use that table. You can look it with the command WRKTBL QSYS/QEBCDIC. You'll notice for example that x'09' in ASCII gets converted to x'05' in EBCDIC. So if you want to get x'05' into part of a packed decimal field on the mainframe, you have to send it x'09'. And so on. Like I said, I would recommend doing something other than this. Ask the mainframe people to not make you used packed decimal, for example.
    PC&#178;

  • Is there any java Charset for converting EBCDIC packed decimal to ASCII?

    Pls reply if you know the solution.

    This is not a function of a Charset, because of the packing. There are plenty of EBCDIC<->ASCII libraries out there.

  • Export to excel - number format

    Hi,
    Our version is SAP ERP Central Component 5.0 and we have just pathed the system from SPS18 to SPS23.
    However from that time has change the export to excel functionality. Now after you select List - Export - Spreadsheet you can select either Excel (in Mhtml format) or All available formats - here the same format as in the old version has option 'Microsoft Excel (In existing XXL format). However when the report is exported eg account numbers do not have the correct format. So you need to convert them first to the correct number format with function VALUE in Excel.
    Can this be somehow fixed?
    Thanks,
    Honza

    Hi,
    Dots and commas is not the issue.
    The issue is that eg doment numbers are in the format in which you cannot vlookup them with other files where document numbers are in number format. So you need first to convert them using excel function value(). And then they have the correct format.
    I am 100% sure there was not the same problem before we installed the higher patch.
    Jan

  • Checking and Converting binary, octal, decimal, and hex

    Hi,
    I have a classroom project which will need to validate that data entered in a text is of a certain type with a keyListener, and then convert that value to the other 3 types.
    I know character.isDigit will handle the decimal case, and that I can then use Integer.otString methods to convert to binary, octal, and hex, but what about the other cases?
    Thanks

    OK, this isn't working. If I've already established
    that the string entered into, for example, the
    integer-only textfield is a valid integer, I should be
    able to simply use integer.parseint(s, 2) to convert
    it into binary, right?Not exactly. You should be able to use Integer.parseInt(s, 2) to return the result of converting it from binary representation. You appear to think that this affects whatever "s" refers to, which is not the case. Note also, that method returns an int which is the decimal value in question.
    When you are thinking of int variables, be careful not to think of them as "decimal" or "binary". They are neither. They are just numbers. "Decimal" and "binary" are text representations of numbers, so those concepts can only be applied to strings.
    Integer.parseInt(s, 2);
    txtBin.setText(s);So here you want to assume that the input is a string that represents a number in decimal, and you want to find the string that represents the number in binary. Like this:// convert string in decimal representation to number
    int dec = Integer.parseInt(s);
    // convert int to binary representation as string:
    String binary = Integer.toBinaryString(dec);
    // write that to the text field
    txtBin.setText(binary);You could use a one-liner to do that, but you'll need the "dec" variable to set the other text boxes.
    Rembering why I hate OO...All of what I said there is true in just about all computer languages, OO or otherwise.
    PC&#178;

  • Loading the data from a packed decimal format file using a sql*loader.

    Hi ,
    In one of the project i'm working here i have to load the data into oracle table from a file using a Sql*loader but the problem is the data file is in the packed decimal format so please let me know if there is any way to do this....I search a lot regarding this ..If anybody faced such type of problem ,then let me the steps to solve this.
    Thanks in advance ,
    Narasingarao.

    declare
    f utl_file.file_type;
    s1 varchar2(200);
    s2 varchar2(200);
    s3 varchar2(200);
    c number := 0;
    begin
    f := utl_file.fopen('TRY','sample1.txt','R');
    utl_file.get_line(f,s1);
    utl_file.get_line(f,s2);
    utl_file.get_line(f,s3);
    insert into sampletable (a,b,c) values (s1,s2,s3);
    c := c + 1;
    utl_file.fclose(f);
    exception
    when NO_DATA_FOUND then
    if utl_file.is_open(f) then utl_file.fclose(f); ens if;
    dbms_output.put_line('No. of rows inserted : ' || c);
    end;SY.

  • Converting character to decimal format

    hi
    i am working on a development where the selection screen has date and time as select options.
    and based on the input i have to concatenate date and time into the format- DD.MM.YYY HH.MM.SS
    there is a value in the table that has a field containing the above value and i have to fetch the data based on this input.
    Now the problem is the field in the table is of format DECIMAL of 16 length.
    i want to know how can i pass this value to the select statement.
    thanks in advance

    Hi ,
    Please check the blog on the below link.
    [Re: Converting char to decimal value format as defined in SU3(User profile);
    This will solve your query.
    Regards
    Abhii......

  • How to convert exponent to number format

    Hi,
    how to convert exponent to number format.My column is in number and the data is in exponent format .for example  data is 2.44705130197009E18 .when i do field name haveing this data like
    select * from table name where filed name =2.44705130197009E18 ,field name  is of number (20) data type .but i am not getting any data fectched .
    your advice is at most appriciated .
    Regards,
    Suja

    Example of what I was saying...
    SQL> create table myexp (name number);
    Table created.
    SQL> insert into myexp values (2447051301970090001);
    1 row created.
    SQL> select name from myexp;
          NAME
    2.4471E+18
    SQL> col name format 9999999999999999999999999999999999999
    SQL> select name from myexp;
                                      NAME
                       2447051301970090001
    SQL>
    The number you are seeing as an exponent is not just the number that is stored with lots of 0's on it, there's other information you are missing, so you need to change your format to see the true value.

  • Program to convert binary to decimal number?

    I only know how to do a program that converts only 4 numbers, but it to convert any amount of digits the number enters, I think you need to use a loop or something, but I'm not sure how. Could someone please help me? This is my code so far:
    import javax.swing.JOptionPane;
    public class bintodec {
         public static void main (String[] args) {
              String input;
              int number,digit1,digit2,digit3,digit4,result;
              input = JOptionPane.showInputDialog ("Enter a binary number.");
              number = Integer.parseInt(input);
              digit1 = ((number % 10000) - (number % 10000 % 1000)) / 1000;
              digit2 = ((number % 1000) - (number % 1000 % 100)) / 100;
              digit3 = ((number % 100) - (number % 100 % 10)) / 10;
              digit4 = (number % 10);
              result = (digit1 * 8) + (digit2 * 4) + (digit3 * 2) + (digit4 * 1);
              System.out.println ( "Binary number: " + input + "\nConverted Decimal Number: " + result);
              System.exit( 0 );
         } // main
    } // bintodecany help is super-appreciated.

    I am not sure if this will help you. Check it out, run it and let me know if it helped.
    import java.util.*;
       public class BitwiseTest1 {
           public static void main(String[] args){
            System.out.println("Enter a integer number:");
            Scanner keyboard = new Scanner(System.in);
            int n1 = keyboard.nextInt();
            System.out.println( "n1 as binary " +
                   Integer.toBinaryString( n1 ));
            System.out.println( "NOT n1 =     " +
                   Integer.toBinaryString( ~n1 ));
            System.out.println("Enter another integer number:");
            int n2 = keyboard.nextInt();
            System.out.println( "n2 as binary " +
                   Integer.toBinaryString( n2 ));
             System.out.println( "NOT n2 =     " +
                   Integer.toBinaryString( ~n2 ));
    }

  • Number formatting with either 2 decimal places or none

    Hello,
    I'm using Acrobat 8 in XP and not familiar with Javascript.
    I have some dollar amount fields where I need it to be number formatted, and limited to 2 decimal places but leave the user the ability to enter only an integer.
    ie, go to two decimal places if any of
    > .
    > .0
    > .00
    > .000(...)
    are present but leave it off if none are present.
    I assume I need a custom format script but I've not been able to learn enough to figure it out yet.
    If anyone can give me some code I can edit and paste, that would be great. Any help is appreciated.

    > Have a String as "3.0000000"
    String s = "3.0000000";
    System.out.printf("%.2f", Double.parseDouble(s)); // 3.00
    Formatting - Numbers and Currencies
    ~

  • Conversion of Packed Decimal Numbers to Java Data Types

    Hi all,
    I'm working with a mainframe file which contains datas in Packed Decimal Numbers.My requirement is to convert these datas to Java datatypes and also to convert the Java datatypes to Packed Decimal Numbers before storing them in the mainframe.
    Can anyone help me out with any code for converting Java data types to/from other data formats such as: EBCDIC, IBM370 COMP (binary numbers up to 9 digits), and COMP-16 (packed decimal numbers)?
    I would hugely appreciate any response to my query.
    Thanking you all,
    Kaushik.

    Rather than go that route, I'd instead look into providing a "service" on your mainframe to:
    1) provide a textual representation of the numbers (from native to text)
    2) read text, converting to native numeric storage
    And use that service to retrieve that information by your Java app (1)Similarly, instead of trying to write natively-formatted numbers from your Java app, I'd write it as text and make that same "service" read the text (2)
    This is the kind of thing XML is for.

  • Parsing a packed decimal value

    I am doing an extraction of BKPF and my ETL process is failing because the data which is being returned via RFC_READ_TABLE for KURS2 is '0.1234-'
    When I go in to SE16 and look at that record, the displayed field value (based on localisation to F) is: '/0,1234'.
    KURS2 has a datatype of P. Its values also should be always unsigned (since a negative currency conversion rate doesn't make any sense). Are signed values in P fields which come out of RFC_READ_TABLE have the - sign at the end (like a BCD?) or is it returning that because the RFC is misparsing the '/' in the actual field? And why would the UI allow someone to enter such a value? (I understand that it looks like whoever entered it wanted something to divide WRBT* by KURS2 to get DMBT2 or whatever, but that seems strange to me).

    How do you store the "PACKED DECIMAL" in Oracle?
    Do you use one of the following data types:
    NUMBER(n,n)
    DECIMAL(n,n)?
    or
    is it mainframe data that is represented in PACKED DECIMAL format that you've loaded into Oracle via SQL Loader.
    P;

  • If a Custom field is defined as Text in Project Server, but is actualy a number field, is it possible to number format it in a report (BI)?

    The users have defined the field as Text, and now the field contains data, so it is not possible to change the type.
    While including the field in the Report and choosing number format, it is not getting formatted (for example, if I want seperators like a comma for thousand).
    Is it possible?
    Thanks in advance.

    Hi,
    I don't think so you can directly format a text field as number in SSRS.  For doing this first you have to convert your text field into Integer or Decimal (whatever is your requirement) into SQL query.
    Then using SSRS textbox properties you can define the number format also can use the 1000 separator from SSRS then.
    To perform this, I have created a "Test" table with 2 columns only "ProjectName" varchar(50) and ProjectDuration Varchar(9).
    Then using SQL query first I converted ProjectDuration datatype from Varchar to INT using below query
    SELECT     ProjectName, CONVERT(int,ProjectDuration) ProjectDuration
    FROM         Test
    Then using SSRS interface changed the ProjectDuration tect box property like this
    That's all I am getting below desire result
    Hope this helps you and let me know in case have any doubts.
    Thanks !!!
    Sachin Vashishth MCTS

  • Number format issue

    I just set up my computer to use the Argentine region to display dates, numbers, times, meassures, etc. The problem is that MS-Excel continues to display the comma to separate thousands instead of periods (i.e: 1,056 instead of 1.056) and this is causing me troubles with calculations. Isn't Mac OS X supposed to handle the number format across the system? or does Exel has a mind of its own when it comes to formatting numbers?
    Thanks

    Microsoft always has marched to the beat of their own drummer but I found this in the Excel help that seems to indicate they are at least trying to do things right. Check the Notes section at the end.
    ===============
    • Format values in euro currency style
    Use this procedure to apply a euro currency style to the selected cells. If the cells you want to format contain non-euro values, you instead need to convert the values to euros by using the EUROCONVERT function.
    To use the EUROCONVERT function, you must select the Euro Currency Tool check box on the Add-ins dialog box (Tools menu, Add-ins command). If you do not see Euro Currency Tool listed in the Add-ins dialog box, then you must install the Excel Add-ins component, and then quit and restart Excel. For step 5 (Installation) of the Setup Assistant, expand Office Tools by clicking the arrow next to it, and then select the Excel Add-ins check box.
    1. To display the Formatting toolbar, click View, point to Toolbars, and then click Formatting.
    2. If you don't see the Euro Style button on the Formatting toolbar, click Preferences on the Excel menu, click Edit, and then select the Show Euro tool check box.
    3. Select the cells that you want to format as euro currency style.
    4. Click the Euro Style button.
    Notes
    • If you want to type the euro sign () in a cell, you can do so on a U.S. keyboard by pressing SHIFTOPTION2.
    • The settings on the Formats or Numbers tab on the International pane (System Preferences) determine the position of the euro sign (that is, whether the symbol appears before or after the number and whether a space separates the symbol and the number), as well as the decimal symbol and the thousands separator.

  • Changing number format

    Hi ,
    I need to change number format . for example if its 1 lakh 1,00,000.56 (56 paise)  its displaying as
    1.00.000,56.
    how to convert it to 1,00,000.56

    System
           -->User Profile
                              -->own data
                                             -->Defaults tab
                                                                --> change decimal naotation accordingly.
    Or try using thousand seperator
    e.g. value(T)

Maybe you are looking for