IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  File Writer unable to interpret Carriage Return

    Posted Mon June 23, 2003 01:30 PM

    Hello,
    While using the file writer service available in the WmSamples package, the /n or carriage return at the end of the each line in the string is converted to a junk character looking like a square.

    When the output file is viewed using notepad, it appears as a single record delimited by this square character, but was supposed to be a set of multiple records of fixed length.

    Could anyone help us to sort this out?

    Details of BC!
    Version 4.6.

    Thanks as usual.
    Bhavani Shankar


    #Flow-and-Java-services
    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: File Writer unable to interpret Carriage Return

    Posted Mon June 23, 2003 03:26 PM

    Try viewing your file using Textpad or Ultraedit. You will find the contents as multiple records.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: File Writer unable to interpret Carriage Return

    Posted Mon June 23, 2003 03:54 PM

    Hello Karthik,
    Just to make the problem more clear. The same string when “Put” using FTP did not contain this character and the file appeared with fixed width. But we are facing this problem only when the File Writer service is used.

    We are using notepad to view both the files. Have I missed something when using File writer??

    Hope I have made it much more clearer!


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB


  • 4.  RE: File Writer unable to interpret Carriage Return

    Posted Mon June 23, 2003 06:03 PM

    \n will appear as an empty square in Notepad (pre-XP). It is not junk–Notepad just displays stand-alone \n and \r chars that way. The XP version of Notepad will display \n as expected.

    When FTP’ing the file, what mode is being used? Text or binary? In text mode, I believe the receiving server is free to “normalize” end of line markers–changing \n to \r\n. That’s why Notepad would start showing the data as expected.


    #Flow-and-Java-services
    #Integration-Server-and-ESB
    #webMethods


  • 5.  RE: File Writer unable to interpret Carriage Return

    Posted Mon June 23, 2003 06:53 PM

    Rob - How do we normalize the end of line markers and force ‘\n’ to ‘\r\n’.

    The reason for this question is we are having one service at the IS side received flatfiles from different systems (mainframe, windows, http protocol, etc). When we analyse the incoming stream, some systems send it with only ‘\n’ character and some have ‘\r\n’ character. The creates problems when we use convertToValues service along with flatfile schema with the file length as +2 (to accomodate \r\n). I need a way to force all the incoming data with \r\n when I receive only \n character.

    Should I use a content handler to handle this ?


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 6.  RE: File Writer unable to interpret Carriage Return

    Posted Mon June 23, 2003 07:32 PM

    If you’re talking about incoming files sent by FTP, then Rob’s right - using text (or ASCII) mode will cause the \n characters to be converted to \r\n.

    If you’re talking about using the file writer service, then the problem is a little different. The service will write whatever string you send it, by default using \r\n for any carriage returns. If you want it to use just \n on a Windows platform, you need your own file writer service that will properly convert the newlines. I use BufferedWriter.newline() when I want a newline character while writing out a file - that generates \n on Windows and \r\n on Unix.


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 7.  RE: File Writer unable to interpret Carriage Return

    Posted Tue June 24, 2003 07:13 AM

    Skip,
    Should the string I have in the pipeline be tokenised. Later the String list must written line by line with a BufferedWriter.newline() in between? Guess, this would make the processing time far more, when the flatfile size is high.

    The convertToValues output which is a fixed width string needs to be saved in a folder for further processing. But the Filewriter is unable to normalize the content.

    Rob,
    Details of FTP-PUT :
    Transfermode = ASCII
    Transfertype = PASSIVE

    Thanks for the information and looking forward for more!!!

    Bhavani Shankar


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services