Help with data output to "Fixed Column Width File"

  • HI -

    I am set a task to extract data and present it to Websphere MQ.

    Multiple lines per records depending on type of record

    Column

    BGM

    6-8 PM1 or PM2

    9-43 StockCode

    44 function ( 3 delete, 4 change, 9 original )

    DTM

    6-8 137 ( document date)

    9-16 yyyymmdd

    The outpuit would look like ..

    BGM PM1stockcodegoeshere 4

    DTM 137yyyymmdd

    any help / guidance / experience would be much appreciated.

    ________________________________________________________________________________________________
    Regards
    Steve
    SQL 2008 DBA/DBD - MCTS/MCITP

    Please don't trust me, test the solutions I give you before using them.

  • I'm sorry but I don't understand what you need nor how your data looks like. Pleas write a small script that creates the tables, insert few rows into the table and then explain what your output should be. If you'll do that your chances of getting help will be better.

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • This was removed by the editor as SPAM

  • Ok sorry for being unclear -

    I have the data stored in a simple single table, to which I need to create a text file that gets imported into "IBM Websphere MQ" software/platform.

    The format of the file is off fixed position text file -

    If I keep it simple - I need to provide StockCode, UoM, DateLastSale, 4 lines of description

    so the table contains ( StockCode char(30), Uom char (2), DateLastSale date, Description1 cahar(50), Description2 cahar(50), Description3 cahar(50), Description4 cahar(50) )

    the text file I generate will be with header lines and detail sections underneath.

    so ...

    text file.

    BGM PM1stockcode

    DTM UOMea

    DTM LSDyyyymmdd

    LIN 0001

    FTX PM1description1

    LIN 0002

    FTX PM1description1

    LIN 0003

    FTX PM1description1

    LIN 0004

    FTX PM1description1

    I can Private message the examples if it would help.

    ________________________________________________________________________________________________
    Regards
    Steve
    SQL 2008 DBA/DBD - MCTS/MCITP

    Please don't trust me, test the solutions I give you before using them.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply