Creating Fixed Length from Database Records

Hello Folks,
I need to take records from a table and write a fixed length
text file. What is the general procedure for doing this? Any
special packages I need?
TIA.
Alex Wolff.

The mechanisms for creating the text file are either to spool a query result from SQL*Plus or to use the UTL_FILE package to write from a PL/SQL procedure.
To write fixed length records you would do well to convert every column to text. A sample select clause might be ...
select to_char(my_number,'99999990.000')||
to_char(my_date,'DD-MM-YYYY')||
rpad(my_text,30) as fixed_output
from ...
I hope this covers your question.

Similar Messages

  • How to get the time length from send record command to record video really?

    I have two buttons. Record/Stop
    I press Record button to record the video and press Stop
    button to stop recording.Now,I spend 1986 ms from press Record
    button to press Stop button.
    But the flv file's length is 1920 or 1910 or 1915 ms.
    So I want to get the time length from send record command to
    record video really.
    Can you give me some suggests.
    Thanks!

    maybe you have lag in publishing.... are you try watch de
    NetStream.liveDelay() method?
    or start counting when NetStream.onStatus has
    "NetStream.Record.Start" and "NetStream.Record.Stop" in information
    objects....

  • How to create Fixed Length Flat File from Open Hub in BI 7.0

    My requirement is to produce a Fixed length Flat file by Open Hub destination. My Open Hub has four fields. Now the requirement is to create another extra field in Open Hub which will contain all of the four fields value. In addition to that the fields should be fixed length that means if for any field no value is there and the field length/type is CHAR4 then 4 spaces should be there as the field value. SO, basically the Open Hub output will be single field which will contain information of four fields.
    How to get this using End Routine of Transformation (from DSO to Open Hub) ?

    Hi,
    You can map the four input fields to the new field in the Open Hub, and change rule type to "Routine".
    For example, if your source fields are called "first", "second", "third" and "forth", the ABAP routine could be similar to:
    DATA: l_t_1  TYPE C LENGTH 4,
          l_t_2  TYPE C LENGTH 4,
          l_t_3  TYPE C LENGTH 4,
          l_t_4  TYPE C LENGTH 4.
    IF source_fields-first IS INITIAL.
      l_t_1 = '    '.
    else.
      MOVE source_fields-first TO l_t_1.
    endif.
    IF source_fields-second IS INITIAL.
      l_t_2 = '    '.
    else.
      MOVE source_fields-second TO l_t_2.
    endif.
    IF source_fields-third IS INITIAL.
      l_t_3 = '    '.
    else.
      MOVE source_fields-third TO l_t_3.
    endif.
    IF source_fields-forth IS INITIAL.
      l_t_4 = '    '.
    else.
      MOVE source_fields-forth TO l_t_4.
    endif.
    CONCATENATE l_t_1 l_t_2 l_t_3 l_t_4 into result.
    In the example, the program uses four blank spaces if any of the fields has no value. 
    Additionally, if non-initial values in input fields could be shorter than 4 characters (if the input fields have no fixed length), you could use STRLEN to evaluate if it is necessary to add blank spaces to complete the fixed length of 4.
    I hope this helps you.
    Regards,
    Maximiliano

  • Fixed length fileadapter [multiple records are of multiple types]

    Hi,
    I am using Jdev 10133 and SOA suite 10133.
    I am using fixed length(multiple records are of different type) file adapter to read data from a DAT file.
    I need to read the data based on condition.
    i.e: the DAT file looks like below
    city1           EMPName1                      female                organisation1
    city2           EMPName2                      male                   organisation2
    city2           EMPName3                      male                   organisation1
    city1           EMPName4                      female                organisation1Here i need to read the records based on gender.
    I was able to read based on city i.e first column.
    In adapter wizard it is giving only endposition.
    How to read data based on gender??
    Plz help me regarding this.
    Regards.
    Edited by: [email protected] on May 21, 2009 1:44 AM

    not sure if this is an exact example but when you create youe xsd you can use white space as a delimiter, so if your fields don't have spaces you can use this.
    Also you can mix and match fixed length with delimiters
    cheers
    James

  • How can I delete the site (created in webDB) from database?

    Hi I have the WebDB 2.2 and Database server Oracle8i and I created a lot of sites with WebDB but I do not know how can I delete them from database server. Could somebody help to me?

    Log into sql plus as webdb
    Drop user <site name>_admin cascade;
    Drop user <site name>_public cascade;
    Drop user <site name> cascade;
    and drop any other users you have made specically for this site.
    Remove the dad from the listener settings.
    If you wish to use this site name again in the same database you also have to delete a record from a table in the Webdb schema.
    I can't remeber what that is.....
    Good Luck
    Dave.
    null

  • Creating dynamically JTree from database values

    Hi,
    I have a local database with some node values. I receive these values from database as a String[].
    short example:
    String[] Values = {"mainNode","Processors","mainNode","RAM","mainNode","Monitors",
    "Processors","INTEL","Processors","AMD","RAM","Kingston","RAM","GoodRAM",
    "Kingston","400MHz","Kingston","433MHz"}First value is higher node, second is a child.
    I'd like to produce dynamically JTree from Values[] like below:
    MainNode
    |----Processors
          |----INTEL
          |----AMD
    |----RAM
          |----Kingston
                |----400MHz
                |----433MHz
          |----GoodRam
    |----MonitorsI can't build up any working and fast solution :(
    Can anyone help me ?
    Please for any advices (samples) which will help me to apply it.
    Dearly regards!

    This is a relatively straight forward task but it smacks of being homework so unless you post what you have already done you are unlikely to be given any code.
    As a hint -
    Go through the data creating a Map between the parent value and a child DefaultMutableTreeNode which contains as user object the child String.
    When you extract a parent String from the data lookup the parent DefaultMutableTreeNode in the map and add the child DefaultMutableTreeNode to the parent DefaultMutableTreeNode.
    Note - All the map is doing is giving you a quick way of looking up a DefaultMutableTreeNode given a parent name.
    Note - that your tree will have problems if the same value appears in two or more branches!

  • Creating EDI file of fixed length from B2B

    Hi Gurus,
    I want to create an edi 810 file from B2B(Outbound) for a partner which has an unusual requirement of the file length. The file length should be 80 characters long.
    The Output EDI should look something like this.
    ISA*00* *00* *01*041158668B *01*006927180 *110118*022
    0*U*00200*000011924*0*P*>~GS*IN*041158668B*006927180*20110118*0220*11924*X*00401
    0~ST*810*0001~BIG*20110118*4295914~REF*DP*Bakery~REF*IA*5169430~N1*ST*ALBERTSONS
    6002 BAKERY 2*9*06002~ITD*05*****20110128*10~DTM*011*20110118~IT1**1*CA*22.28*
    UP007829619749*VN*167~PID*F****FOCACCIA~PO4*35*12*OZ~IT1**1*CA*18.4**UP*003967
    707020*VN*12034~PID*F****BOULE SOURDOUGH~PO4*12*16*OZ~IT1**1*CA*45.33**UP*077098
    106100*VN*20894~PID*F****SCONE 2BT CRML TOFEE~PO4*24*11.25*OZ~IT1**1*CA*35.22**U
    P*004116398356*VN*22791~PID*F****DONUT PWD SGR HOLE~PO4*24*10*OZ~IT1**1*CA*16.46
    **UP*003967707000*VN*22882~PID*F****LRG BOULE SOURDGH~PO4*10*24*OZ~IT1**1*CA*17.
    5**UP*004116397450*VN*22896~PID*F****ANGEL FOOD BAR~PO4*15*10.5*OZ~IT1**1*CA*15*
    UP004116397451*VN*22897~PID*F****SHORTCAKE CUPS~PO4*30*4.5*OZ~IT1**1*CA*16.8**
    UP*004116397453*VN*22898~PID*F****ANGEL RINGS~PO4*8*16*OZ~IT1**1*CA*20.63**UP*00
    7987940430*VN*23366~PID*F****MUFFIN SF CHOCOLATE MINI~PO4*8*10*OZ~IT1**1*CA*20.9
    6**UP*007987940066*VN*23386~PID*F****LOAF SF SLICED POUND~PO4*8*14*OZ~SAC*A*F800
    ***56*******02***PROMOTION ALLOWANCE~IT1**1*CA*22.27**UP*002056910140*VN*27832~P
    ID*F****DONUT O F BUTTERMILK CAKE~PO4*96*3*OZ~IT1**1*CA*60.1**UP*077388911720*V
    N*28396~PID*F****DANISH PKT ALMOND BEARCLAW~PO4*144*3*OZ~IT1**1*CA*35.5**UP*0773
    88911729*VN*28398~PID*F****DANISH PLAIN RND TWIST~PO4*120*2.5*OZ~IT1**1*CA*20.48
    **UP*002056912011*VN*29120~PID*F****DONUT GOLDEN LONG JOHN~PO4*84*3*OZ~IT1**1*CA
    *22.27**UP*002056910101*VN*29121~PID*F****DONUT VANILLA CAKE~PO4*96*3*OZ~IT1**1*
    CA*39.78**UP*087062500522*VN*29161~PID*F****EGG CHALLAH K~PO4*20*19.75*OZ~IT
    1**1*CA*22.66**UP*002056980050*VN*29288~PID*F****DONUT RASPFILLED SHELL~PO4*84*4
    OZ~IT1*1*CA*22.66**UP*002056980060*VN*29290~PID*F****DONUT CUSTFILLED SHELL~PO
    4*84*4*OZ~IT1**1*CA*24.73**UP*002056912240*VN*29350~PID*F****DONUT GOLDN APPLE F
    RITTER~PO4*72*3*OZ~IT1**1*CA*20.02**UP*002056912030*VN*29359~TDS*61293~CAD*SR***
    ROUTE666~CTT20~SE*71*0118~GE*118*11924~IEA*1*000011924~
    Please help me on this.
    I am using B2B 10.1.2.
    Regards
    Ayush

    This is valid rule as the partner might has AS400 system for processing documents. In this case both inbound/outbound docs to/from that partner need to have this 80 char BLOCK rule applied.
    What method is partner using for file exchange. In case VAN, you might need to ask partner to check their VAN and have this 80 char BLOCK rule applied at mailbox level. This way VAN provider will automatically handle this for both inbound and outbound.
    Thanks,
    Vijay.

  • Creating separate forms from Database

    I'm using Acrobat 9.1.2 and LiveCycle Designer ES ver. 8.2.1x.
    I have an MS Access database populated with names/info regarding various people (Customers).  I'm trying to create/generate separate (Order) forms, one for each Customer, each pre-populated with the Customer's contact information from the database.  I want to e-mail each customized form to each Customer.
    Each Customer should be able to change/correct inaccurate Customer information on the form (set control "Type" to "Calculated - User can override"?).
    Each form will also have a table containing various "Products" (not connected to the database) and drop-down list controls from which each Customer can select the number/quantity of each Product he/she wants to order.  Price extensions, subtotals, and totals are all calculated using FormCalc.
    The Customer will then be able to both "Submit by e-mail," and "Print" and return the form by mail with his/her payment.  I will then collect/assemble the returned .xml files and import them into the MS Access database myself.
    Where I'm hung up is when I connect the Order form to the database, only one form is created, and only data from the first record appears in it.  How do I create one form for each Customer from the database?
    You can e-mail me at [email protected]

    So each record in the DB represents a separate instance of the form to be mailed out to someone.....right?
    Normally that level of functionality is done server side but there is one reason why you may not want to do this clicent side. Let me explain. You woudl have to write an automation script that woudl retrieve each record from the DB. Once a record is retrieved you coudl automate the mail of the doc , then get the next record and mail ...etc...until all records are done. All of this is possible except for the sending of the email. Acrobat/Reader will allow you to create the email message and control all aspects of it, but it will not allow you to send an email without the user hitting the send button. So if you want to have the mail generated, then hit send after every instance then it could be done.
    If you do this using server products then this is not an issue and can be easily done, but note that the cost of the server products will make the solution out of reach for all but the company's that do mass mailings or e-statements etc.
    Hope that helps
    Paul

  • Create fixed assets from within the transaction for creating the purchase order

    Hello All,
    I have gone through the notes on help.sap.com related to automatic creation of asset master record at the time of creating purchase order.  I am not sure how do we achieve this?
    Link to the notes on help.sap.com
    SAP Library - Asset Accounting (FI-AA)
    Any suggesstions from the expert group is appreciated.
    Thank you,
    Vinay

    Hi Vinay
    I know there is a feature whereby you assign asset classes per material group and then you create assets from within the PO. I never used it though
    Let me tell you one thing or rather ask you. Will you as a finance consultant be willing to let a MM guy create the assets??
    Or will a MM guy be willing to create it?? If you allow them, you should be ready for surprises.
    Honestly, this is a feature not worth exploring unless a FI guy is willing to create the PO. I would suggest the creation of asset masters should be with FI only
    Br. Ajay M

  • Creating Fix length file help?

    Hi
    I need to create a text file that is 80 Characters in length, so spaces must be filled.
    I'm using Class Attribute CL_ABAP_CHAR_UTILITIES=>CR_LF.
    But when I do this it created additonal lines in the file so instead of  5 lines i get 10 lines.
    Any solutions will be appreciated?
    REPORT  YTEST7.
    class CL_ABAP_CHAR_UTILITIES definition load.
    data: L_LINE(133) type c.
    TYPES : BEGIN OF itable_out_text,
                line(1000) TYPE c,
              END OF itable_out_text.
    DATA : lt_out_text TYPE STANDARD TABLE OF itable_out_text WITH HEADER LINE.
    concatenate 'SYSTEM: ' SY-SYSID
                'USER: ' SY-UNAME
                'CLIENT: ' SY-MANDT
                 into L_LINE.
    l_line+80 = CL_ABAP_CHAR_UTILITIES=>CR_LF .
    do 5 times.
    lt_out_text-line = l_line.
    append lt_out_text.
    enddo.
        CALL FUNCTION 'GUI_DOWNLOAD'
          EXPORTING
            filename                = 'C:\testing.txt'
            filetype                = 'ASC'
          TABLES
            data_tab                = lt_out_text.
    Edited by: KevC on May 22, 2008 2:41 PM

    Kev,
    When exporting the table to the text file,  Adding CRLF to the end will cause a blank like as the process does that anyway.
    The problem is how to force an 80 char Record length.
    Generally when reading this type record in, by whatever you are passing this file to, would read one line at at time and the imbedded CRLF would signify the end of the record.  When whatever is reading this in, if the process has the input record defined as 80 bytes,
    you should be fine.
    Only other solution that I can think of is to bury a character in the 80th position and let the reading process ignore or change that character to a space when they read it in.

  • How can I extract the create preference script from database

    I have 10.2.0.3 database. I have a schema that has text schema indexes. I need to load the data to another user.
    Here is my steps:
    1. create a new user dev.
    2. expdp user prod
    3. impdp prod to dev META_DATA_ONLY
    4. drop schema indexex, otherwise, there is error.
    5. recreate schema index.
    My problem is when I recreate the indexes. I got this error
    ERROR at line 1:
    ORA-29855: error occurred in the execution of ODCIINDEXCREATE routine
    ORA-20000: Oracle Text error:
    DRG-10700: preference does not exist: OCS_IDCCOLL1_LEXER
    ORA-06512: at "CTXSYS.DRUE", line 160
    ORA-06512: at "CTXSYS.TEXTINDEXMETHODS", line 364
    I ran
    select pre_name from CTX_PREFERENCES wehre pre_owner='PROD'
    OCS_IDCCOLL1_LEXER
    How can I recreate the OCS_IDCCOLL1_LEXER for user dev?
    Thanks a lot!

    Try running CTX_REPORT.CREATE_INDEX_SCRIPT: see http://download.oracle.com/docs/cd/B14117_01/text.101/b10729/admin.htm#CACFCCDA.

  • Creating xml schema from database attributes

    Hi,
    I am trying to generate dynamic xml schemas from a java program.
    Please suggest me some solutions.
    The scenario is like this.
    The input to the java program is a table[oracle] name
    and based on that table's column headers, i need to define and
    create the xml schema dynamically.
    The purpose is that at a later point of time, i may
    need to copy the content of the database to xml files.
    Please reply with your suggestions.
    Thanks in advance,
    Dilip

    XML Schema itself is a well formed XML document. You can write a small utility class which can do this for you by using any XML API available in Java.
    Thanks,
    Tejas

  • Create a link from database

    I am using dreamweaver and am new to php.
    I have a field Map_String containing
    http://maps.google.com/staticmap?center=40.714728,-73.998672&zoom=14&size=512x512&maptype= mobile&markers=40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.99 8284,redc&key=ABQIAAAATotG25YVOf4zCWnbvczg2hTGT278_JCnmvJMEjRLCiYPguMCxxQ4fuf3_8qpre1icP6- YoywNxF44w
    I can extract this data and display in a text box :
    mysql_select_db($database_mapping, $mapping);
    $query_Maprecord = "SELECT Map_String FROM gps_data";
    $Maprecord = mysql_query($query_Maprecord, $mapping) or
    die(mysql_error());
    $row_Maprecord = mysql_fetch_assoc($Maprecord);
    $totalRows_Maprecord = mysql_num_rows($Maprecord);
    <form id="form1" name="form1" method="post" action="">
    <label>test
    <input value="<?php echo $row_Maprecord['Map_String'];
    ?>" type="text"
    name="textfield" />
    </label>
    </form>
    I need convert the above into a link but cannot work out the
    correct syntax.
    Any help appreciated
    SteveW

    I have added the code when run locally the link takes me to
    the google page
    but I get error
    Google
    Error
    Bad Request
    Your client has issued a malformed or illegal request.
    If I cut and paste the link from IE and paste into a new
    window I get the
    google map as expected. The site is at www.iw10.co.uk.
    My Code as follows:
    <?php require_once('Connections/Mapping.php'); ?>
    <?php require_once('../Connections/Mapping.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType,
    $theDefinedValue = "",
    $theNotDefinedValue = "")
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue)
    : $theValue;
    $theValue = function_exists("mysql_real_escape_string") ?
    mysql_real_escape_string($theValue) :
    mysql_escape_string($theValue);
    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) .
    "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue :
    $theNotDefinedValue;
    break;
    return $theValue;
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType,
    $theDefinedValue = "",
    $theNotDefinedValue = "")
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue)
    : $theValue;
    $theValue = function_exists("mysql_real_escape_string") ?
    mysql_real_escape_string($theValue) :
    mysql_escape_string($theValue);
    switch ($theType) {
    case "text":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "long":
    case "int":
    $theValue = ($theValue != "") ? intval($theValue) : "NULL";
    break;
    case "double":
    $theValue = ($theValue != "") ? "'" . doubleval($theValue) .
    "NULL";
    break;
    case "date":
    $theValue = ($theValue != "") ? "'" . $theValue . "'" :
    "NULL";
    break;
    case "defined":
    $theValue = ($theValue != "") ? $theDefinedValue :
    $theNotDefinedValue;
    break;
    return $theValue;
    mysql_select_db($database_Mapping, $Mapping);
    $query_Today = "SELECT gps_data.`Lat`, gps_data.Lon FROM
    gps_data WHERE
    gps_data.`Date` = CURDATE()";
    $Today = mysql_query($query_Today, $Mapping) or
    die(mysql_error());
    $row_Today = mysql_fetch_assoc($Today);
    $totalRows_Today = mysql_num_rows($Today);
    mysql_select_db($database_Mapping, $Mapping);
    $query_Latest = "SELECT gps_data.`Lat`, gps_data.Lon,
    gps_data.User_name,
    gps_data.Time,gps_data.Map_String FROM gps_data ORDER BY num
    desc LIMIT 1
    $Latest = mysql_query($query_Latest, $Mapping) or
    die(mysql_error());
    $row_Latest = mysql_fetch_assoc($Latest);
    $totalRows_Latest = mysql_num_rows($Latest);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN"
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml"
    xmlns:v="urn:schemas-microsoft-com:vml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1" />
    <title>Untitled Document</title>
    <script type="text/javascript">
    /*wagmp*/
    <?php include("google_javascript/wagmp_map_7.php"); ?>
    </script>
    <script type="text/javascript"
    src="
    http://maps.google.com/maps?file=api&v=2&key=ABQIAAAATotG25YVOf4zCWnbvczg2hTcEsAHU3LXVmOGC 0eZSg7FL02XvRS3LK1xQLb_4dVJ6v3Kby31TMMAbg">/*wagmp*/</script>
    <script type="text/javascript">
    /*wagmp*/
    <?php include("google_javascript/wagmp_map_10.php"); ?>
    </script>
    </head>
    <body>
    <p><img src="images/iw10 logo.png" width="210"
    height="96" /> </p>
    User: <?php echo $row_Latest['User_name']; ?>
    <p>Time: <?php echo $row_Latest['Time'];
    ?></p>
    <p> <?php echo $row_Latest['Map_String'];
    ?></p>
    <p><a href="<?php echo $row_Latest['Map_String'];
    ?>">Map</a>
    </p>
    <p>iW10/Research and Development: Server
    Testing  </p>
    <p> <a href="\Demo_big.php"></a>iw10: All
    location and alerts-24hours (total
    := <?php echo $totalRows_Today ?> ) </p>
    <p>
    </p>
    <p></p>
    <script type="text/javascript"
    src="google_javascript/wagmp_maps.js">/*wagmp*/</script>
    </body>
    </html>
    <?php
    mysql_free_result($Today);
    mysql_free_result($Latest);
    ?>
    "Murray *ACE*" <[email protected]> wrote
    in message
    news:[email protected]...
    > <a href="<?php echo $row_Maprecord['Map_String'];
    ?>">Map</a>
    >
    > --
    > Murray --- ICQ 71997575
    > Adobe Community Expert
    > (If you *MUST* email me, don't LAUGH when you do so!)
    > ==================
    >
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    >
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    > ==================
    >
    >
    > "SteveW" <[email protected]> wrote in
    message
    > news:[email protected]...
    >>I am using dreamweaver and am new to php.
    >>
    >> I have a field Map_String containing
    >>
    http://maps.google.com/staticmap?center=40.714728,-73.998672&zoom=14&size=512x512&maptype= mobile&markers=40.702147,-74.015794,blues%7C40.711614,-74.012318,greeng%7C40.718217,-73.99 8284,redc&key=ABQIAAAATotG25YVOf4zCWnbvczg2hTGT278_JCnmvJMEjRLCiYPguMCxxQ4fuf3_8qpre1icP6- YoywNxF44w
    >> I can extract this data and display in a text box :
    >>
    >> mysql_select_db($database_mapping, $mapping);
    >> $query_Maprecord = "SELECT Map_String FROM
    gps_data";
    >> $Maprecord = mysql_query($query_Maprecord, $mapping)
    or
    >> die(mysql_error());
    >> $row_Maprecord = mysql_fetch_assoc($Maprecord);
    >> $totalRows_Maprecord = mysql_num_rows($Maprecord);
    >>
    >>
    >> <form id="form1" name="form1" method="post"
    action="">
    >> <label>test
    >>
    >> <input value="<?php echo
    $row_Maprecord['Map_String']; ?>" type="text"
    >> name="textfield" />
    >> </label>
    >> </form>
    >>
    >> I need convert the above into a link but cannot work
    out the correct
    >> syntax.
    >>
    >> Any help appreciated
    >>
    >> SteveW
    >>
    >>
    >>
    >

  • Extracting multiple variables of different fixed length from a string ( Java )

    Dear all,
    I am expecting an input string of
    NationalBroadCastTony12245tv0930113024213tv0820230022214tv0915140024213rd10002300
    I need to display it in the following format:
    Telecastor: NationalBroadCast
    Presenter:Tony
    ch_code
    pg_code
    source
    start_time
    end_time
    1
    2245
    tv
    0930
    1130
    2
    4213
    tv
    0820
    2300
    2
    2214
    tv
    0915
    1400
    2
    4213
    rd
    1000
    2300
    I know the starting and ending position of Telecastor, and Presenter in the input string. I also know the position of the start element of the table(starting of the loop). I also know the length of a single row( allows me to contruct the loop). I reckon regex is probably not the best way since there is no pattern matching. I am looking at some sort of a config driven logic.
    Are there any java string function that I can use together with some form of config driven configuration that anyone can suggest?
    I am looking along the line of some configuration like eg
    telecastor 17
    Presentor  4
    pg_code 4 ( anything after character 21 is the loop)
    source 2
    start_time 4
    end_time 4
    For example another input I can expect is
    ElementaryScienceAccessment223-Feb-131500-1730RegentHallE32344390E21235487A23443564G23443246
    I need to display as
    Exam:ElementaryScience
    Nature: Accessment2
    Date:23-Feb-13
    Time:1500-1730
    Venue:RegentHall
    Student ID
    Score
    E323443
    90
    E212354
    87
    A234435
    64
    G234432
    46
    Exam:17
    Nature:11
    Date:9
    Time:9
    Venue:10
    Student ID:7 (anything after 56 is a loop)
    Score:2
    Unfortunately the input stream is not in XML format. What sort of string function/config driven logic can I use to allow me to define a 1 config fits all mechanism?

    Are there any java string function that I can use together with some form of config driven configuration that anyone can suggest?
    Well there is the obvious one: the 'substr' method of the String class.
    http://docs.oracle.com/javase/6/docs/api/java/lang/String.html
    Your 'config' would be the list of start/end or start/length values for each of the components.
    The usual parsing issue is knowing how to determine when one element ends and the next one starts. For this fragment of yours:
    12245tv
    How do you know if the first component, 'ch_code', is '1', '2', or '122'?

  • How to create a fixed length file

    Can anyone suggest a simple technique for creating fixed
    length files? CSV and delimited files are pretty simple using
    CFFILE. Is there an elegant way to create fixed length
    files?

    Simplest: Use LJustify() or RJustify() on your lines of data.
    EG:
    <cfset FileLine = RJustify (LineOfText, 128)>

Maybe you are looking for

  • Styling input radio buttons not working in linux firefox

    On linux we cannot use radio buttons switch from foundation zurb. Look at this issue: https://github.com/zurb/foundation/issues/1615#issuecomment-14593962.

  • Batch sequence folder location in Win7

    Sorry to duplicate this -- got the message saying it was answered, but the link led nowhere and the question itself appears to have vanished. I'm trying to figure out where to copy my user-defined batch sequences for the migration from the old WinXP

  • Updating from 10.4.7 to...10.4.8? or 9, I don't know what's out.

    I'm running 10.4.7 right now, I'm thinking I'm finally going to update to 10.4.8 or whatever. How should I go about this? I have 11 updates right now, most of them software updates, two of them firmware updates, and one of them the update from 10.4.7

  • Elements 11 Problems Since Upgrading Mac To Yosemite

    Since upgrading my Mac to Yosemite i have been having trouble with photoshop elements 11. In expert mode i am able to use the levels adjustment just fine but when in 'Guided" mode which i use most often the levels adjustment does not work. It does no

  • SSL Connection from a Java Stored Procedure

    Hello. I have a Java stored procedure for sending emails, using the JavaMail API. I need to use gmails as the SMTP server. Google requires that emails sent from their servers must be sent through SSL and must be authenticated. I'm having trouble in a