Fixed Length Strings.

Hi ,
   I have to download a longtext from SAP.
   The length of the longtext has to be fixed 5000 ie...Even if the length of the longtext from SAP is 1000 remaining 4000 spaces should get appended.
  I am moving the long text into a variable l_line which I have declared in the following way L_LINE(5000).
   But after moving the longtext into this variable it still shows the actual length of the longtext whereas I need 5000 fixed length.
  How to solve it.
Thanks,

Hi Renu Raj,
Just WRITE the LONG TEXT again in to the variable with RIGHT
JUSTIFIED. It will prefixes SPACEs and STRLEN will return 5000.
i.e. as follows,
  WRITE : L_LINE TO L_LINE RIGHT-JUSTIFIED.
  CNT_LEN = STRLEN( L_LINE ).
Now the CNT_LEn will have '5000'.
While you process the LONG TEXT, just CONDENSE it and go ahead. It will remove LEADING SPACEs.
i.e. as follows,
  CONDENSE L_LINE.
  CNT_LEN = STRLEN( L_LINE ).
Now CNT_LEN will have an actual length.
Regards,
R.Nagarajan.
We can -

Similar Messages

  • A better way of building the fixed-length String

    I created the following code to build a fixed length string. I checked other posts for the same topic, but I found mine is better. The code below converts a double numeric value to a fixed length string with padding of white spaces (or other types):
    Line 15 initializes the char array to while space; line 13 creates a character array; lines 17, 18 copy the array created in line 13 to the one initialized in line 15.
    Any comment is welcomed.
    1. import java.text.*;
    2.
    3. public class jformat {
    4.
    5. public static void main(String[] args) {
    6.
    7. char[] fb=new char[14];
    8. char[] tb;
    9. int c, f;
    10. DecimalFormat fmt=new DecimalFormat("########0.00");
    11. double dbl=12345.66;
    12.
    13. tb=fmt.format(dbl).toCharArray();
    14.
    15. for(c=0; c<fb.length; c++) fb[c]=' ';// this line is not required in JDK 1.5
    16.
    17. for(c=tb.length-1, f=fb.length-1; c>=0; c--, f--){
    18.     fb[f]=tb[c];
    19. }
    20. System.out.println(new String(fb));
    21.
    22. }
    23.
    24. }

    Here's a couple of alternatives. One uses a StringBuffer and the second, for Java 5 only, uses the Formatter capabilities.
    import java.text.DecimalFormat;
    public class jformat
        public static void main(String[] args)
            int fieldSize = 14;
            double dbl = 12345.66;
            String dblString = new DecimalFormat("0.00").format(dbl);
            StringBuffer sb = new StringBuffer();
            for (int j = 0; j < fieldSize - dblString.length(); j++)
                sb = sb.append(' ');
            System.out.println(sb.append(dblString).toString());
             *  The above code works in Java versions 1.3, 1.4, and 1.5.
             *  However, 1.5 provides the Formatter class, and the single
             *  line below can replace the preceeding code.
            System.out.printf("%14.2f%n", dbl);
    }

  • ABPA  code to compress table into a table of fixed-length strings

    Hi all,
    I need to compress a large, sparse table into a table of fixed-length strings in my ABAP code, and then uncompress it.  Is there a standard format or facility to do this?  I seem to remember a function that does this, but any other hints would be appreciated.
    Thank you in advance,
    Sunny

    For example, given a table like:
    Column0    Column1    Column2
    abc            C               !@#&@
                     P
    def                              $*(
    Compress it into a table consisting of one column of fixed-length strings, like:
    Column0
    0abc1C2
    !@#&@01
    P20def1
    2$*(
    ..and then uncompress it back out to the original table.
    Sunny

  • How to map xml to a fixed length string?

    Hi All,
    I have a requirement to map request xml to a string of fixed length and format:
    For eg,
    Source:
    <Person>
    <Name>George</Name>
    <Age>21</Age>
    </Person>
    Target:
    String of format
    Name : 8 chars
    Age : 2chars.
    so the required mapping should result in
    "George 21".
    Note: 2 blanks after "George" to allow for 8 characters. Is this kind of mapping possible using ALSB xquery? I have tried to create a MFL representation for the string , and used it in the xquery as the targer but it is generating
    "George21".Only data present in source is getting mapped :(

    My advice would be to use MFL transformation for that.
    Documentation about MFL can be found at edocs: http://edocs.bea.com/alsb/docs26/fbhelp/index.html
    Find tips and tricks about ALSB at my blog: http://dev2dev.bea.com/blog/jordinho/

  • How to build a fixed-length string representing an integer

    Hi,
    I would like know how can I use the API to get a String representing an int with fixed length. I mean, I would like something similar to Integer.parseInt(), but I need to set the length of that String in such a way that, for instance, if I need the String to be 5 character long, and the int is 37, the String would be 00037
    Thanks in advance and best regards,
    Miguel ?ngel

    I wrote pad() methods in my string helper that can be used for this purpose.
    In particular, you want to prepad with '0' to a length of 5:
    com.Ostermiller.StringHelper.prePad(Integer.toString(37), 5, '0');
    http://ostermiller.org/utils/StringHelper.html

  • Fixed-length numbers and strings

    Hello,
    I have to make a critical decision about API usage. I would be grateful if some of you could share their experiences. This will help me make an informed decision and avoid potential trouble further down the line.
    I have to use fixed-length integer numbers and fixed-length strings such as for example:
    -A string that is exactly 5-letter long (no longer and no shorter than 5 letters). e.g. "abcde"
    -A number that is exactly 8-digit long (no longer and no shorter than 8 digits). e.g. "12345678"
    Ideally I would get some sort of exception when the "container" for the letters or digits contains less or more than what the spec says.
    I am not sure which classes or primitives could meet my needs. As far as the fixed-length string is concerned I initially thought of using a array of chars but an array of chars is not that easy to manipulate and contains "garbage" until you explicitely fill it in with data. I'd rather some sort of class.
    Can anyone please advise me?
    Thanks in advance,
    Julien.

    Why not use the same thing like in the case of the String
    /**Warning: this is an example and not very good design.*/
    public class FixedInteger {
       private int min, max;
       private int value;
       public int getValue() { return value;}
       public void setValue(int v) {
            if (v >= min && v < max) {
                throw new Exception();
            value = v;
       /**ex. min = 10000, max = 100000 for 5 digit numbers*/
       public FixedInteger(int min, int max, int value) {
           this.min = min; this.max = max;
           setValue(value);
    }You can do tricks like convert it to immutabla like the String and Integer class in the Java Api
    Edited by: szgy on Oct 5, 2007 2:22 PM

  • How to get a string with fixed length

    I want to implement something like movechar() of c in java. I want to return a string which has a fixed length that contains the given string and spaces for remaining length.
    Please let me know how can I implement it.
    Thanks & Regards,
    Nasrin.n

    Do you mean padding a String?
          * This method pads the string s to size n using char c to make up for missing characters.
         public static String padString(String s, int n, char c, boolean paddingLeft) {
              StringBuffer str = new StringBuffer(s);
              int strLength = str.length();
              if (n > 0 && n > strLength) {
                   for (int i = 0; i <= n; i++) {
                        if (paddingLeft) {
                             if (i < n - strLength) str.insert(0, c);
                        else {
                             if (i > strLength) str.append(c);
              return str.toString();
         }

  • Need to download a file which si space delimted and has fixed length char

    Hi,
    I have a custom report which downloads an output file in text format.I need the contents to be space delimited.My file data contains numbers as well as characters.I ahve pased the parameter WRITE_FIELD_SEPARATOR = ' ' in the FM.Hwoever the space is introduced only oif the column value is a character.If its a number/digit,the columns are not seperated by space.
    Now my data appears like that:
    0000101310179.28 +0827200808 DHLBSRF VISA AUG 2008US021SW111 RYAN,BICOVNY
    I want my data to be like this :
    0000101310 179.28 + 0827200808 DHLBSRF VISA AUG 2008 US02 1SW111 RYAN,BICOVNY
    DO I need to pass any additinal parametre?Also for fixed length characrets,do i need to pack/unpack data before passing to the FM ?
    Thanks.

    Hi,
    try this way.
    REPORT ztest_notepad.
    DATA: BEGIN OF it_download OCCURS 0,
           data TYPE string,
          END OF it_download.
    DATA: BEGIN OF it_vbrk OCCURS 0,
            vbeln TYPE vbrk-vbeln,
            fkart TYPE vbrk-fkart,
            fktyp TYPE vbrk-fktyp,
            netwr TYPE vbrk-netwr,
          END OF it_vbrk.
    DATA : l_netwr TYPE char21.
    "START-OF-SELECTION.
    START-OF-SELECTION.
      SELECT  vbeln
              fkart
              fktyp
              netwr
       FROM vbrk
       INTO CORRESPONDING FIELDS OF TABLE it_vbrk
       UP TO 100 ROWS.
      LOOP AT it_vbrk.
        l_netwr = it_vbrk-netwr.
        CONCATENATE it_vbrk-vbeln
                    it_vbrk-fkart
                    it_vbrk-fktyp
                    l_netwr
            INTO it_download-data
            SEPARATED BY space.
        APPEND it_download.
        CLEAR  it_download.
      ENDLOOP.
      CALL FUNCTION 'GUI_DOWNLOAD'
           EXPORTING
                filename = 'C:\test.txt'
                filetype = 'ASC'
           TABLES
                data_tab = it_download.
    Thanks
    Venkat.O

  • Parameters for Ingesting wide fixed-length files?

    I created an SSIS process to ingest fixed-length text files into this table.
    CREATE TABLE [dbo].[Temp_Source_Fixed](
     [Column 0] [text] NULL,
     [ID] [int] IDENTITY(1,1) NOT NULL,
     CONSTRAINT [Temp_Source_Fixed_ID] PRIMARY KEY CLUSTERED
     [ID] ASC
    )WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    It works fine with most of the files, but one file has almost 26000 characters per row and the process halts with a truncation error.
    I suspect that if I change a parameter on the connection manager it will work, since I can manually use
    the SSMS wizard to import manually if I specify Text Stream (DT_Text) for the data type of Column 0 versus String (DT_STR).
    For the connection manager I have
        In the connection string I have Provider=SQLNCLI10.1 and Auto Translate=False.
        In Misc parameters, DelayValidation=False.
    For the Data Flow Task I have
     DefaultBufferSize is 10485760
    Any ideas on what I need to change?
    Thanks,
    Jnana
    Jnana Sivananda

    You need the column in question defined in SSIS as DT_Text.
    You need to either drop the flat file connector and re-do it with this datatype, or access the Advanced Editor input and output column and alter its datatype there
    Arthur
    MyBlog
    Twitter

  • Gui_download issue - trailing spaces getting truncated for fixed length fil

    Hi All,
    I have a requirement where I need to download an internal table as a fixed length file.
    The code is as follows:
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    BIN_FILESIZE =
    FILENAME = L_FILE
    FILETYPE = 'ASC'
    APPEND = 'X'
    WRITE_FIELD_SEPARATOR = ' '
    HEADER = '00'
    TRUNC_TRAILING_BLANKS = ' '
    WRITE_LF = ' '
    COL_SELECT = ' '
    COL_SELECT_MASK = ' '
    DAT_MODE = ' '
    IMPORTING
    FILELENGTH =
    TABLES
    DATA_TAB = IT_TEXT
    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
    Each row in the internal table IT_TEXT is 242 chars long.
    The FM is truncatinf the trailing blanks on the file. How do I get the FM to not truncate the trailing blanks in each row?
    My internal table has multiple rows and the number of rows on the table should be same as the number of rows on the downloaded file.
    I tried setting the WRITE_LF parameter to space.
    In this case, the trailing spaces are not truncated(which is as per my requirement), BUT all the rows in the internal table appear in a single line on the downloaded file instead of multiple rows.
    I also tried setting the TRUNC_TRAILING_BLANKS field to space but that does not work either. Spaces at the end of the row are still truncated.
    so the requirement is: the spaces at the end of each row should not be truncated and
    each row on the internal table should have a corresponding row on the downloaded file.
    (it is a fixed length file)
    I also tried using the following code
    class cl_abap_char_utilities definition load.
    DATA: BEGIN OF IT_TEXT OCCURS 0,
           TEXT(242) TYPE C,
           cr_lf TYPE c VALUE cl_abap_char_utilities=>cr_lf,
          END OF IT_TEXT.
    when i compile, i get the following error
    The type "CL_ABAP_CHAR_UTILITIES" is unknown.     
    Im using R/3 4.6C. Could this be a problem?     
    Please suggest a solution for this problem.
    Thanks!
    Sandeep
    Edited by: sandeep reddy on Jul 25, 2008 7:16 PM

    Hi,
    Try this..This worked..Add a dummy character at the end of the internal table...Then pass trunc_trailing_blanks   = ' '...
    PARAMETERS: p_file TYPE rlgrap-filename
                DEFAULT 'c:\test_download.txt'.
    DATA: BEGIN OF s_data,
            data TYPE char10,
            dummy,      " Added this.
          END OF s_data.
    DATA: t_data LIKE TABLE OF s_data.
    s_data-data = 'Test'.
    APPEND s_data TO t_data.
    s_data-data = 'Test2'.
    APPEND s_data TO t_data.
    s_data-data = 'Test3'.
    APPEND s_data TO t_data.
    s_data-data = 'Test4'.
    APPEND s_data TO t_data.
    * Download.
    DATA: v_file TYPE string.
    v_file = p_file.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
        filename                = v_file
        trunc_trailing_blanks   = ' '
      TABLES
        data_tab                = t_data
      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.
    Thanks
    Naren

  • Reading fixed length flatfile & splitting it into header and lineitem data

    Hi Friends,
    I am reading a fixed length flat file from application server into an Internal table.
    But problem is, data in flat file is in the below format with fixed start and end positions.
    1 - 78 -  control header
    1 - 581 - Invoice header data
    1 - 411 - Invoice Line item data
    1 - 45 -   trailer record
    There will be one control header and one trailer record per file and number of invoice headers and its line items can vary.
    There is unique identifiers to identify as below.
    Control header - starts with 'CHR'
    Invoice Header starts with - '000'
    Invoice Lineitem stats with - '001'
    trailer record - starts with 'TRL'
    So its like
    CHR.......control  data..(79)000.....header data...(660)001....lineitem1...(1481)001...lineitem2....multiples of 411 and 581 and ends with... TRL...trailer record..
    (position)
    I am first reading the data set and store in internal table with a field of 255char.
    by looping on above ITAB i have to split it into Header records and line item records.
    Did anyone face this kind of scenario before. If yes appreciate if you can throw some ideas on logic to split this data.
    Any help in splitting up the data is highly appreciated.
    Regards,
    Simha
    ITAB declaration
    DATA: BEGIN OF ITAB OCCURS 0,
                   FIELD(255),
               END OF ITAB,
                lt_header type table of ZTHDR,
                lt_lineitem type table of ZTLINITM.

    Hi,
    i am sending sample code which resembles your requiremeant.
    data: BEGIN OF it_input OCCURS 0, "used for store all the data in one line.
          line type string ,
          END OF it_input,
          it_header type TABLE OF string WITH HEADER LINE,"use to store all header with corresponding items
          it_item   type TABLE OF string WITH HEADER LINE.."used to store all item data
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = 'd:\test.txt'
      FILETYPE                      = 'ASC'
      HAS_FIELD_SEPARATOR           = ' '
      HEADER_LENGTH                 = 0
      READ_BY_LINE                  = 'X'
      DAT_MODE                      = ' '
      CODEPAGE                      = ' '
      IGNORE_CERR                   = ABAP_TRUE
      REPLACEMENT                   = '#'
      CHECK_BOM                     = ' '
      VIRUS_SCAN_PROFILE            =
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
      HEADER                        =
      tables
        data_tab                      = it_input
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
      NO_BATCH                      = 3
      GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
      NO_AUTHORITY                  = 6
      UNKNOWN_ERROR                 = 7
      BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
      SEPARATOR_NOT_ALLOWED         = 10
      HEADER_TOO_LONG               = 11
      UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
      DP_OUT_OF_MEMORY              = 14
      DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    LOOP AT  it_input.
       write : it_input-line.
    ENDLOOP.
    before doing the below steps just takethe controle record and trail record cutt of from the table input based up on the length
      split it_input-line AT '000' INTO TABLE it_header IN CHARACTER MODE.
      LOOP AT  it_header.
        split it_header AT '0001' INTO TABLE it_item IN CHARACTER MODE.
        write :/ it_header.
      ENDLOOP.
    after this you need to cut the records in tocorresponding  fields in to respective tables by putting loop on item and header table as i decleared above.
    i think this may solve your problem you need to keep some minnor effort.
    Regaurds,
    Sree..

  • Reading a fixed length file

    Hi All,
    I am trying to read a fixed length file with .DAT extension through an FTP Adapter. I am using a read(polling) operation.
    In the file there are three records(H,D,T). The length of all the three records is more than 100.When I am trying to build a schema for that file using native format builder, maximum position that i get is 100 and if i manually try to put the position beyond 100 say 120,while building the schema and then run the composite using the generated schema, the file is not polled from the location So if anyone could help me to clarify my doubts regarding reading of fixed length files.
    a. Can i read i fixed length file which contains records whose position is more than 100.
    b. If yes, then how do i do that?
    Any help is appreciated.
    Thanks in Advance.

    Here's one way to start. Extend this class for the particular functionality you want:import java.io.DataInputStream;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    /** Processes binary files which have embedded data records. */
    public abstract class BinaryInputFile extends File
    * Class constructor.
    * @param fileName The input file name.
    * @throws NullPointerException if the <code>pathname</code> parameter is <code>null</code>
    protected BinaryInputFile(String fileName) throws NullPointerException
       super(fileName);
    * Reads the file, one line at a time, passing each line to the subclass� process()
    * function.
    * @throws IOException if an error occurs.
    public void process() throws IOException
       DataInputStream stream = new DataInputStream(new FileInputStream(this));
       process(stream);
    * Process the file data.
    * @param stream The input stream.
    protected abstract void process(DataInputStream stream);
    }

  • Please help with reading fixed-length file

    I am reading a fixed-length file from a batch program and I need to read through each line, parsing out records in each, and replacing the first character in each line after I finish processing. I am using a RandomAccessFile, but I am not sure if this is best for my needs.
    Here is essentially the code that I am using:
    RandomAccessFile raf = new RandomAccessFile(File, "rw");
    int pointer = 0;
    int recordLength = 65;
    int counter = 0;
    string test = "X";
    pointer = raf.getFilePointer();
    while ((line = raf.readLine()) != null) {
    //set file pointer
    seek(counter * recordLength);
    counter ++;
    if (line.substring(0, 1).equals(test)) {
    continue;
    var1 = line.substring(7, 22);
    var2 = line.substring(23, 41);
    var3 = line.substring(42, 52);
    var4 = line.substring(53, 53);
    //PROCESSING
    raf.writeChar(test);

    Thanks for the suggestion. I think that the
    BufferedReader is the way that I will go. Do you
    happen to know the best way to update the 1st Char of
    each line as I'm reading each line using Buffered
    Writer?Hi,
    To update the first char of each line, you could read each line of the file into a StringBuffer, modify the value, and then write the value back out to the file.
    I had to do something similar.
    eg.
    StringBuffer buf = new StringBuffer();
    BufferedReader in = new BufferedReader(
        // data file source
    new FileReader(db_location));
    String s;
    // while there are still items to read
    while ((s = in.readLine()) != null)
        System.out.println("reading file");
        // split into component parts so we can modify
        StringTokenizer t = new StringTokenizer(s,",");
        int id = Integer.parseInt(t.nextToken());
        String code = t.nextToken();
        int quantity = Integer.parseInt(t.nextToken());
        // copy component parts into StringBuffer
        buf.append(id+",");
        buf.append(code+",");
        buf.append("\n");
         // use StringBuffer methods here to isolate first character
         // use StringBuffer methods to replace first value of input in buffer
         // eg.
              buf.replace(index,length,","+ new_code);
    // print out the StringBuffer to rewrite updated file
    PrintWriter output = new PrintWriter(
        new BufferedWriter(
        new FileWriter(db_location, false)));
    output.println(buf.toString());
    output.close();As always, there is more than one way to skin a cat. But this is my way.
    I think that JDK 1.4 has some new methods, but not 100% sure of that.
    //Daniel.

  • Problem while writing to fixed length flat file from xml

    Hi,
    I have a problem in writing data into a flat file of fixed length...
    My input is a xml file and i want the output as a flat file. I am successful in converting the xml into flat file... But the main problem is, i am unable to insert spaces in between my fields in the flat file.
    The data in the flat file comes without spaces... Any suggestions on writing the schema...
    Regards
    Surya.

    Have a look at this doc
    http://otndnld.oracle.co.jp/document/products/as10g/101310/doc_cd/integrate.1013/b28994/nfb.htm#BGBBAJFD
    your element should be something like this, it pads with a space using the paddedBy expression
    <xsd:element name="C1" type="xsd:string" nxsd:style="fixedLength" nxsd:length="4" nxsd:paddedBy=" " nxsd:padStyle="tail" />if having trouble post what you want the file to look like, and the xsd you are using.
    cheers
    James

  • File Adapter Fixed Length File issue

    Hi,
    I have a fixed length flat file with each row 13 characters long. First character of each row represents a record type i.e. 0,1,2,3,4,5,6,7,8,9 here is my sample file:
    0123456     
    960373      
    A602710542583
    7602710542583
    1602750499275
    4602750499275
    1602750529800
    7602750529800
    1603030507732
    7603030507732
    1603030509055
    7603030509055
    1603030509229
    7603030509229
    2603600556240
    0603600566095
    2603600567460
    3603310536370
    5603310525810
    3603310531092
    3603310521842
    0603310521842
    3603310521842
    3603310521842
    860201450SA A
    560201451SA A
    560201452SA A
    560201453SAN
    1603630565355
    7603630565355
    1603630565500
    7603630565500
    9603460539390
    2603460535260
    3603790509870
    560200401ABIL
    660372TX066 
    660373TX01531
    660373TX01532
    860373TX066 
    660373TX068 
    360373TX09465
    660373TX09471Here is the schema
    <schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://xmlns.oracle.com/pcbpel/tstSchema/SMP" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" targetNamespace="http://xmlns.oracle.com/pcbpel/tstSchema/SMP" elementFormDefault="qualified" attributeFormDefault="qualified" nxsd:version="NXSD" nxsd:stream="chars">
         <element name="SMP">
              <complexType>
                   <choice maxOccurs="unbounded" nxsd:choiceCondition="fixedLength" nxsd:length="1">
                        <element ref="tns:smpRecords" nxsd:conditionValue="0" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="1" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="2" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="3" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="4" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="5" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="6" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="7" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="8" minOccurs="0" maxOccurs="unbounded"/>
                        <element ref="tns:smpRecords" nxsd:conditionValue="9" minOccurs="0" maxOccurs="unbounded"/>      
                   </choice>
              </complexType>
         </element>
         <element name="smpRecords" type="tns:smpRecordsType"/>
         <complexType name="smpRecordsType">
              <sequence>
                   <element name="data1" type="string" nxsd:style="fixedLength" nxsd:length="2" nxsd:padStyle="tail" nxsd:paddedBy=" "/>
                   <element name="data2" type="string" nxsd:style="fixedLength" nxsd:length="3" nxsd:padStyle="tail" nxsd:paddedBy=" "/>
                   <element name="emp" type="string" nxsd:style="terminated" nxsd:terminatedBy="${eol}"/>
              </sequence>
         </complexType>
    </schema>When I run the process I get the following output and that is not correct as the first character is also being shown in the output as opposed to be skipped as it is the record type and the output should start from second character.
    output
    <SMP>
    <smpRecords>
    <data1>12</data1>
    <data2>345</data2>
    <emp>6 </emp>
    </smpRecords>
    <smpRecords>
    <data1>96</data1>
    <data2>037</data2>
    <emp>3 </emp>
    </smpRecords>
    <smpRecords>
    <data1>A16</data1>
    <data2>027</data2>
    <emp>10542583</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>027</data2>
    <emp>10542583</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>027</data2>
    <emp>50499275</emp>
    </smpRecords>
    <smpRecords>
    <data1>46</data1>
    <data2>027</data2>
    <emp>50499275</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>027</data2>
    <emp>50529800</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>027</data2>
    <emp>50529800</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>030</data2>
    <emp>30507732</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>030</data2>
    <emp>30507732</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>030</data2>
    <emp>30509055</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>030</data2>
    <emp>30509055</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>030</data2>
    <emp>30509229</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>030</data2>
    <emp>30509229</emp>
    </smpRecords>
    <smpRecords>
    <data1>26</data1>
    <data2>036</data2>
    <emp>00556240</emp>
    </smpRecords>
    <smpRecords>
    <data1>06</data1>
    <data2>036</data2>
    <emp>00566095</emp>
    </smpRecords>
    <smpRecords>
    <data1>26</data1>
    <data2>036</data2>
    <emp>00567460</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>033</data2>
    <emp>10536370</emp>
    </smpRecords>
    <smpRecords>
    <data1>56</data1>
    <data2>033</data2>
    <emp>10525810</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>033</data2>
    <emp>10531092</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>033</data2>
    <emp>10521842</emp>
    </smpRecords>
    <smpRecords>
    <data1>06</data1>
    <data2>033</data2>
    <emp>10521842</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>033</data2>
    <emp>10521842</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>033</data2>
    <emp>10521842</emp>
    </smpRecords>
    <smpRecords>
    <data1>86</data1>
    <data2>020</data2>
    <emp>1450SA A</emp>
    </smpRecords>
    <smpRecords>
    <data1>56</data1>
    <data2>020</data2>
    <emp>1451SA A</emp>
    </smpRecords>
    <smpRecords>
    <data1>56</data1>
    <data2>020</data2>
    <emp>1452SA A</emp>
    </smpRecords>
    <smpRecords>
    <data1>56</data1>
    <data2>020</data2>
    <emp>1453SAN </emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>036</data2>
    <emp>30565355</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>036</data2>
    <emp>30565355</emp>
    </smpRecords>
    <smpRecords>
    <data1>16</data1>
    <data2>036</data2>
    <emp>30565500</emp>
    </smpRecords>
    <smpRecords>
    <data1>76</data1>
    <data2>036</data2>
    <emp>30565500</emp>
    </smpRecords>
    <smpRecords>
    <data1>96</data1>
    <data2>034</data2>
    <emp>60539390</emp>
    </smpRecords>
    <smpRecords>
    <data1>26</data1>
    <data2>034</data2>
    <emp>60535260</emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>037</data2>
    <emp>90509870</emp>
    </smpRecords>
    <smpRecords>
    <data1>56</data1>
    <data2>020</data2>
    <emp>0401ABIL</emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>2TX066 </emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>3TX015 </emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>3TX01531</emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>3TX01532</emp>
    </smpRecords>
    <smpRecords>
    <data1>86</data1>
    <data2>037</data2>
    <emp>3TX066 </emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>3TX068 </emp>
    </smpRecords>
    <smpRecords>
    <data1>36</data1>
    <data2>037</data2>
    <emp>3TX09465</emp>
    </smpRecords>
    <smpRecords>
    <data1>66</data1>
    <data2>037</data2>
    <emp>3TX09471</emp>
    </smpRecords>
    </SMP>As the output for the very first row comes up fine i.e. 0123456
    for this the output is
    <smpRecords>
    <data1>12</data1>
    <data2>345</data2>
    <emp>6 </emp>
    </smpRecords>But for all the rest it keeps adding the first character too i.e. 960373
    for this the output is wrong
    <smpRecords>
    <data1>96</data1>
    <data2>037</data2>
    <emp>3 </emp>
    </smpRecords>as the correct output should be:
    <smpRecords>
    <data1>60</data1>
    <data2>373</data2>
    <emp/>
    </smpRecords>Any idea what I am doing wrong or how I can fix the schema. Also if I add any character other than 0....9 for the first character it still picks up the record i.e. A602710542583
    as it should only process records starting with 0....9
    Thanks

    I tried using transformation to check if the starting 2 chars are 56 then output else continue but the ourput is blank even though I have multiple records that start with 56. Here is the xsl I have
    <?xml version="1.0" encoding="UTF-8" ?>
    <?oracle-xsl-mapper
      <!-- SPECIFICATION OF MAP SOURCES AND TARGETS, DO NOT MODIFY. -->
      <mapSources>
        <source type="XSD">
          <schema location="test2.xsd"/>
          <rootElement name="SMP" namespace="http://xmlns.oracle.com/pcbpel/tstSchema/SMP"/>
        </source>
      </mapSources>
      <mapTargets>
        <target type="XSD">
          <schema location="test2.xsd"/>
          <rootElement name="SMP" namespace="http://xmlns.oracle.com/pcbpel/tstSchema/SMP"/>
        </target>
      </mapTargets>
      <!-- GENERATED BY ORACLE XSL MAPPER 10.1.2.0.2(build 060111.0746) AT [TUE OCT 31 08:47:08 CST 2006]. -->
    ?>
    <xsl:stylesheet version="1.0" xmlns:ldap="http://schemas.oracle.com/xpath/extension/ldap" xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:tns="http://xmlns.oracle.com/pcbpel/tstSchema/SMP" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:ns0="http://www.w3.org/2001/XMLSchema" xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc" xmlns:nxsd="http://xmlns.oracle.com/pcbpel/nxsd" exclude-result-prefixes="xsl tns ns0 nxsd ldap xp20 bpws ora orcl">
      <xsl:template match="/">
        <tns:SMP>
          <xsl:for-each select="/tns:SMP/tns:smpRecords">
            <xsl:if test="tns:data1 = '56'">
              <tns:smpRecords>
                <tns:data1>
                  <xsl:value-of select="tns:data1"/>
                </tns:data1>
                <tns:data2>
                  <xsl:value-of select="tns:data2"/>
                </tns:data2>
                <tns:emp>
                  <xsl:value-of select="tns:emp"/>
                </tns:emp>
              </tns:smpRecords>
            </xsl:if>
          </xsl:for-each>
        </tns:SMP>
      </xsl:template>
    </xsl:stylesheet>and here is the out I get
    <part   name="SMP" >
    <SMP/>
    </part>Any ideas what might be wrong in the xsl itself.
    Thanks

Maybe you are looking for

  • Digitally Sign All Signature Fields in the Active Document

    I have a script which will sign a single digital signature field by the field name. I need to revise the script so it will sign multiple/all signature fields in the active document without having to put the field name in the script, as the field name

  • Chart series lines going over each other

    All i have a chart with 3 series, how do i get it so that the lines are all separate, at the moment they go over each other and i can't see each of the three, i know that some of the values are the same, and some are near to each other, but how do i

  • Iphone 3gs does not turn on after ios 6 update

    After the ios6 update, my iphone 3gs does not turn on. I see the apple logo, after a minute, it boots again and i see the logo again. This process seems to continue like a circle. After a search the net, i see that i am not the only one. A quick fix

  • Having trouble upgrading after downloading the program

    it tells me to upgrade the download goes successfully,buy then it takes me back to the upgrade screen again.

  • HT1349 Printing

    How do I print from my iPad 2 with a wireless dell printer