Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9046685
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:42:41+00:00 2026-06-16T11:42:41+00:00

I have writen a script below that performs a line feed behavior (see attached

  • 0

I have writen a script below that performs a line feed behavior (see attached image as reference output). But when I transmitted the text file via FTP, it results to a feedback error of “Delimiters of the file is incorrect. It is still carriage return & line feed. It should just be a line feed. ”

Hoping for a response from anybody….

PBScript:

Long ll_row
ll_row = dw_Outbound.InsertRow(0)
dw_Outbound.SetITem(ll_row,'message',as_message)
as_message = ""

text buffer

File Write Function Script :

    //Retrieve Transaction Set Header
    ids_TSH = CREATE DataStore
    ids_TSH.DataObject = 'd_inventory_advice_transetheader'
    ids_TSH.SetTransObject( SQLCA )
    ids_TSH.Retrieve()
    IF ids_TSH.ROwCount() = 1 THEN 
        ls_Msg += Trim(ids_TSH.Object.headerid[1])
        ls_Msg += "*" + Trim(ids_TSH.Object.setidcode[1])
        ls_Msg += "*" + Trim(ids_TSH.Object.setctrlnum[1])
        ls_Msg += "|" 
        //Set LineFeed
        //ls_Msg += "~n"
        of_ReturnOutboundMessage(ls_Msg)
        of_getInventoryAdviceTranRowCount(ls_Msg)
    END IF

    //Retrieve Beginning Segment
    ids_BIA = CREATE DataStore
    ids_BIA.DataObject = 'd_inventory_advice_begsegment'
    ids_BIA.SetTransObject(SQLCA)
    ids_BIA.Retrieve()
    IF ids_BIA.RowCount() = 1 THEN
        ls_Msg += Trim(ids_BIA.Object.biaid[1])
        ls_Msg += "*" + Trim(ids_BIA.Object.trnsetpcode[1])
        ls_Msg += "*" + Trim(ids_BIA.Object.reptypecode[1])
        ls_Msg += "*" + Trim(ids_BIA.Object.refid[1])
        ls_Msg += "*" + is_BIADATE
        ls_Msg += "|"   
        of_ReturnOutboundMessage(ls_Msg)
        of_getInventoryAdviceTranRowCount(ls_Msg)
    END IF

    //Assigned DateTime Reference
    ls_Msg += "DTM"
    ls_Msg += "*" + "007"        
    ls_Msg += "*" + is_BIADATE
    ls_Msg += "*" + is_Time
    ls_Msg += "*" + "UT"
    ls_Msg += "|" 
    of_ReturnOutboundMessage(ls_Msg)
    of_getInventoryAdviceTranRowCount(ls_Msg)

    //Assigned Reference Identification
    ls_Msg += "REF"
    ls_Msg += "*" + "EO"         
    ls_Msg += "*" + "SAPMBT01" //ISA06 SENDERID : SPI818TEST
    ls_Msg += "|"
    of_ReturnOutboundMessage(ls_Msg)
    of_getInventoryAdviceTranRowCount(ls_Msg)

    lds_Data = CREATE DataStore
    lds_Data.DataObject = 'd_inventory_advice_subinv_phldef'
    lds_Data.SetTransObject(SQLCA)
    lds_Data.Retrieve()

    lds_Name = CREATE DAtaStore
    lds_Name.DataObject = 'd_inventory_advice_nameheader'
    lds_Name.SetTransObject(SQLCA)
    lds_Name.Retrieve()

    IF lds_Name.RowCount() = 1 THEN 
        ls_Msg += Trim(lds_Name.Object.nameid[1])
        ls_Msg += "*" + Trim(lds_Name.Object.entityidcode[1])
        ls_Msg += "*" + Trim(lds_Name.Object.entityname[1])
        ls_Msg += "*" + Trim(lds_Name.Object.idcodequal[1])
        ls_Msg += "*" + Trim(lds_Data.Object.subinv[1])
        ls_Msg += "|"
        of_ReturnOutboundMessage(ls_Msg)
        of_getInventoryAdviceTranRowCount(ls_Msg)

        ls_Msg += Trim(lds_Name.Object.addressid[1])
        ls_Msg += "*" + Trim(lds_Name.Object.addressinfo[1])
        ls_Msg += "|"
        of_ReturnOutboundMessage(ls_Msg)
        of_getInventoryAdviceTranRowCount(ls_Msg)

        ls_Msg += Trim(lds_Name.Object.glid[1])
        ls_Msg += "*" + Trim(lds_Name.Object.cityname[1])
        ls_Msg += "*" + 'ML' //STATE OR PROVINCE CODE
        ls_Msg += "*" + Trim(lds_Name.Object.postalcode[1])
        ls_Msg += "*" + Trim(lds_Name.Object.countrycode[1])
        ls_Msg += "|"
        of_ReturnOutboundMessage(ls_Msg)
        of_getInventoryAdviceTranRowCount(ls_Msg)
    END IF

    //Administration Communication Contact
    /*lds_Contact = CREATE DataStore
    lds_Contact.DataObject = 'd_inventory_advice_contact'
    lds_Contact.SetTransObject(SQLCA)
    lds_Contact.Retrieve()
    IF lds_Contact.RowCOunt() = 1 THEN 
        ls_Msg += Trim(lds_Contact.Object.accid[1])
        ls_Msg += "*" + Trim(lds_Contact.Object.fnccode[1])
        ls_Msg += "*" + Trim(lds_Contact.Object.name[1])
        ls_Msg += "*" + Trim(lds_Contact.Object.numqual[1])
        ls_Msg += "*" + Trim(lds_Contact.Object.telnum[1])
        ls_Msg += "|"
        of_ReturnOutboundMessage(ls_Msg)
        of_getInventoryAdviceTranRowCount(ls_Msg)
    END IF*/

    //Initialize DataStore To Handle Line Item RowCount 
    ids_ITem = CREATE DAtaStore 
    ids_ITem.DataObject = 'd_edi_outbound_message_external'
    ids_ITem.SetTransObject( SQLCA )

    IF lds_Data.RowCOunt() > 0 THEN 
        FOR ll_Data = 1 To lds_Data.RowCOunt()      
            ls_item = lds_Data.getitemString(ll_Data, 'itemcode')
            ls_qtyonhand = String(lds_Data.getItemNumber(ll_Data,'sohqty'))
            ls_qtyavailable = String(lds_Data.getItemNumber(ll_Data,'availableqty'))
            ls_subinv = lds_Data.getItemString(ll_Data,'subinv')        

            ls_Msg = "LIN**MG*" + ls_item + "|"
            of_ReturnOutboundMessage(ls_Msg)
            of_getItemCodeRowCount(ls_Msg)
            of_getInventoryAdviceTranRowCount(ls_Msg)

            ls_Msg = "QTY*17*" + ls_qtyonhand + "|"
            of_ReturnOutboundMessage(ls_Msg)
            of_getInventoryAdviceTranRowCount(ls_Msg)

            ls_Msg = "QTY*33*" + ls_qtyavailable + "|"
            of_ReturnOutboundMessage(ls_Msg)
            of_getInventoryAdviceTranRowCount(ls_Msg)

            ls_Msg = "UIT*EA|"
            of_ReturnOutboundMessage(ls_Msg)
            of_getInventoryAdviceTranRowCount(ls_Msg)
        NEXT
    END IF

    ll_Filter = ids_ITem.RowCount()
    //Transaction Total
    ls_Msg += "CTT*" + String(ll_Filter) + "|"
    of_ReturnOutboundMessage(ls_Msg)
    of_getInventoryAdviceTranRowCount(ls_Msg)

    //Retrieve Set Trailer
    ids_TST = CREATE DataStore
    ids_TST.DataObject = 'd_inventory_advice_transettrailer'
    ids_TST.SetTRansObject(SQLCA)
    ids_TST.Retrieve()

    IF ids_TST.RowCount() = 1 THEN  
        of_getInventoryAdviceTranRowCount(ls_Msg)
        //Get the  DataStore RowCount For Trasaction Set Trailer
        is_SetTrailer = String(ids_InvTranTrailer.RowCount())

        ls_Msg += Trim(ids_TST.Object.trailerid[1])+ "*" + is_SetTrailer + "*"
        ls_Msg += Trim(ids_TSH.Object.setctrlnum[1]) + "|"
    END IF
    of_ReturnOutboundMessage(ls_Msg)

    //Note: Function below should not be remove.
    //of_getInventoryAdviceGroupTrailer()
    //of_getInventoryAdviceControlTrailer()

    GETDATETIME:
    ls_ServerDate = gnv_app.of_getServerDateTime()

    IF is_ServerDateNull = ls_ServerDate THEN GOTO GETDATETIME
    is_ServerDateNull = ls_ServerDate   

    FilePath = String(dw_path.Object.outboundfilepath[1])
    FileName = 'EDI_846_' + ls_ServerDate + '.TXT'
    FileDir = FilePath + '/' + FileName

    dw_Outbound.SaveAs(FileDir, TEXT!, FALSE)

    dw_Outbound.Reset()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:42:42+00:00Added an answer on June 16, 2026 at 11:42 am

    The problem you’ve run into is the difference between the concept of newline between different operating systems. PowerBuilder is (at point of this writing, you haven’t described which function is transporting data from the DataWindow into a text file) creating a file with Windows-style newlines (CR+LF, or in PowerScript, "~r~n"), whereas your FTP or FTP recipient (not clear where this message is coming from) wants Unix-style newlines (LF, or in PowerScript, "~n"). If you want control over how the newlines are generated, you’re going to have to write the file yourself (in script, using FileOpen(), FileWrite(), etc… and not relying on PB to generate newlines, so no FileOpen (..., LineMode!, ...))

    Good luck,

    Terry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a script image.php that is quite long, but I've just copied
I have a Python3 script that writes its output to stdout, but it complains
I have the current script included below that goes into a file with extension
I have written a little bash script that reads commands (one per line), in
I have written a script that fires a jQuery POST to retrieve data from
I have written a script which works, but I'm guessing isn't the most efficient.
So I have a strange question. I have written a script that re-formats data
I have written a Python script that will generate a series of graphs and
I have written a Perl script for the following bioinformatics question, but unfortunately there
Hey everyone, I have written a script that downloads a zip file from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.