ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Carriage Return In RPG ILE

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Carriage Return In RPG ILE

    Hi
    I am writing a rpg program which sends emails with an attachment file. The lines in the attachment file are not positioned correctly as the carriage return is not working. I attach the coding in the program.

    0107.00 * Carriage Return Symbol
    0108.00 D @W_ASCIICarriageReturn..0
    0109.00 D S 0 1A Inz(X'0D')

    0291.00 ReadE @Kl_conmsgd1 RCONMSGD;
    0292.00
    0293.00 If %EOF(CONMSGD1);
    0294.00 COData = @W_ASCIICarriageReturn;
    0295.00 Write RCONATCX;
    0296.00 EndIf;
    0297.00
    0298.00 DoW Not %EOF(CONMSGD1);
    0299.00
    0300.00 Clear RCONATCX;
    0301.00 COData = %Trim(MSMSG) + @W_ASCIICarriageReturn;
    0302.00 Write RCONATCX;
    0305.00
    0306.00 ReadE @Kl_conmsg RCONMSGD;
    0307.00
    0308.00 EndDo;

    The output is like

    Barcode 123456789011111 does not exist
    Barcode 123456789011111 does not exist
    Barcode 123456789011111 does not exist
    Barcode 123456789011111 does not exist
    Barcode 123456789022222 does not exist
    Barcode 123456789022222 does not exist

    Please help

    Devarshi

  • #2
    Re: Carriage Return In RPG ILE

    Devarshi,

    Try using a carriage return and a line feed.

    Code:
    d CRLF            C                   CONST(X'0d25')
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

    Comment


    • #3
      Re: Carriage Return In RPG ILE

      Hi
      I tried that but still theoutput is like below.

      Barcode 123456789011111 does not exist
      Barcode 123456789011111 does not exist
      Barcode 123456789011111 does not exist
      Barcode 123456789022222 does not exist
      Barcode 123456789022222 does not exist
      Barcode 123456789033333 does not exist


      Regards
      Devarshi.

      Comment


      • #4
        Re: Carriage Return In RPG ILE

        Which tool are you using to email?
        All my answers were extracted from the "Big Dummy's Guide to the As400"
        and I take no responsibility for any of them.

        www.code400.com

        Comment


        • #5
          Re: Carriage Return In RPG ILE

          Hi
          I'm using the command SNDDST within RPG ILE program.

          @P_Command = 'SNDDST TYPE(*FILE) TOUSRID((INTERNET SMTPRTE))' + ' ' +
          %Trim(@W_Description) + ' ' +
          %Trim(@W_Address) + ' ' +
          'MSG(''' + %Trim(@W_Message) + ''')' + ' ' +
          @W_File + ' ' + 'DOCTYPE(*FFT)' + ' ' + %Trim(@W_Subject

          Comment


          • #6
            Re: Carriage Return In RPG ILE

            I have never attempted to send a barcode with the snddst command.
            I could be wrong but i believe you would need mime support to do this.

            IBM has a free tool called MMAIL and it can be downloaded from here.
            IBM i RPG developers may very easily create web sites by using Easy400.net tools. Remote support is provided.



            thanks
            jamie
            All my answers were extracted from the "Big Dummy's Guide to the As400"
            and I take no responsibility for any of them.

            www.code400.com

            Comment


            • #7
              Re: Carriage Return In RPG ILE

              Hi
              I did not explain properly. The attachment file contains the barcodes. The name of the attachment file is @W_File in the SNDDST command. This file is a 'DOCTYPE(*FFT)' type.

              The records in the attachment file are read from a normal DDS file and when viewing the records they do not have any extra spaces anywhere. Its just when I open the attachment file from within the email, the records are not aligned properly.

              Regards
              Devarshi.

              Comment


              • #8
                Re: Carriage Return In RPG ILE

                How r you getting the records to the IFS...are you writting them directly using system API's or using the cpytopcd command...
                as far as I know you can only use snddst *DOC from the QDLS not the IFS/ROOT
                so the commands cpytostmf and cpytiimpf r not available.

                I could be wrong.

                jamie
                All my answers were extracted from the "Big Dummy's Guide to the As400"
                and I take no responsibility for any of them.

                www.code400.com

                Comment


                • #9
                  Re: Carriage Return In RPG ILE

                  If its a PC program reading the mail then carriage return/line feed is X'0D0A'
                  Life is a constant struggle against maturity

                  Comment


                  • #10
                    Re: Carriage Return In RPG ILE

                    Thank God (Spaghetti) your here I was just stalling till someone with skills showed up.......


                    jamie
                    All my answers were extracted from the "Big Dummy's Guide to the As400"
                    and I take no responsibility for any of them.

                    www.code400.com

                    Comment


                    • #11
                      Re: Carriage Return In RPG ILE

                      Another thought, if you're sending HTML mail then you need to use proper HTML formatting to give your line breaks because CRLF is treated as a white space and ignored.
                      Life is a constant struggle against maturity

                      Comment


                      • #12
                        Re: Carriage Return In RPG ILE

                        hes not sending html email he is just sending a table he creates on the iseries to the ifs (somehow) as an attachement.

                        Its the file that is giving him the error while opening it after he detatches it from his email to his desktop.
                        All my answers were extracted from the "Big Dummy's Guide to the As400"
                        and I take no responsibility for any of them.

                        www.code400.com

                        Comment


                        • #13
                          Re: Carriage Return In RPG ILE

                          Hi
                          I have tried all the tips but no luck.
                          The RPG ILE program writes to an externally decribed DDS file which is 71 char long. It is this file that is attached to the email.

                          @P_Command = 'SNDDST TYPE(*FILE) TOUSRID((INTERNET SMTPRTE))' + ' ' +
                          %Trim(@W_Description) + ' ' +
                          %Trim(@W_Address) + ' ' +
                          'MSG(''' + %Trim(@W_Message) + ''')' + ' ' +
                          @W_File + ' ' + 'DOCTYPE(*FFT)' + ' ' + %Trim(@W_Subject);

                          This file is *FFT type.

                          The attached file when viewed from the email looks like the following, the xxx are the empty spaces. The first record is displayed, rest are not aligned.

                          Barcode 123456789011111 does not exist
                          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxBarcode 123456789011111 does not exist
                          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxBarcode 123456789011111 does not exist
                          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxBarcode 123456789022222 does not exist
                          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxBarcode 123456789022222 does not exist
                          xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxBarcode 123456789033333 does not exist

                          Please help.

                          Also my gender is female.

                          Devarshi.

                          Comment


                          • #14
                            Re: Carriage Return In RPG ILE

                            Its nice to have another female to take the heat off me

                            anyway I dont think I like that you are writting to a source member on the iseries in EBCIDEC and sending to a PC which expects the data to be ASCII.

                            Please try a test...

                            use command CPYTOPCD on that source member and then on the snddst use type *DOC and see if the outcome is not better. (You will need to create a folder on the IFS (QDLS) )

                            PHP Code:
                            CRTFLR FLR(SOMEFLDRAUT(*ALL
                            The cpytopcd will autoMagically convert from EBCIDEC to ASCII.

                            jamie
                            All my answers were extracted from the "Big Dummy's Guide to the As400"
                            and I take no responsibility for any of them.

                            www.code400.com

                            Comment


                            • #15
                              Re: Carriage Return In RPG ILE

                              It looks to me like the attachment is line breaking and then adding the remaing 33 blank from your file to the begining of the next line.

                              You have a 71 character file that you are attaching. You are placing a line break at position 38. The trailing 33 characters are being pushed to the beginning of the next line.


                              Try adding your line break to the last position in your file. Postion 71.


                              Code:
                              COData = %Trim(MSMSG) 
                              CODate = %SubSt(CODate:1:70) + @W_ASCIICarriageReturn
                              Or you might even be able to add it to the first position in the file for every record greater than 1.
                              Last edited by kpmac; March 9, 2006, 09:55 AM.
                              Predictions are usually difficult, especially about the future. ~Yogi Berra

                              Vertical Software Systems
                              VSS.biz

                              Comment

                              Working...
                              X