Join two 8 bit integers and send via Serial Port

I am trying to join two 8 bit integers and send the result via the serial port.
I have a constant of hex value A that I need to join with a value from hex 0 - F (this is based on incoming data)
When I use the Join VI, and type cast to change from hex to string for Visa Write, I recieve hex 0A0F.
I have been able to use the hex 0-F with a case structure and then wire the corresponding constant ex A0 - AF.
This makes the program very cumbersome and labour intensive to change. I have 22 commands I have to respond to with the address of 0-F.
Currently, I have a Case structure that is selected with Message ID, then a case that is selected with subtype and then a case for address.
Therefore I have to create a constant inside of each address case for each message as the responses are different.
Thanks for any help
Robin

Gambin,
As I understand it, you want to take the two bytes, put them together,
and output the result as an ASCII string on the serial port.  This
is easy.  Simply convert each number to an ASCII string,
concatonate the two characters together, and send the resulting string
to the VISA write function.  That's it!  I have attached a VI
(ver. 7.1) that takes two hex numbers as input, converts them to ASCII,
concatonates the results, and outputs the 'command' string.  Fell
free to modify this vi and use it as you see fit.  I have left
extra terminals in case you want to add error input/output for data
flow, or whatever.  Notice that the display for the concatonated
string is in '/' Codes Display mode.  This is because 0A hex is
the newline character in ASCII.  You should also check to make
sure that your VISA serial settings are not setup so that the newline
character is the termination character.  If it is, the second
character may not be recognised.  Hope this helps.
Roy
Attachments:
HextoCommand.vi ‏17 KB

Similar Messages

  • Join two  tables BKPF and VBRK

    I need a report that will join two  tables BKPF and VBRK in QuickViewer. The only field with the right character length is XBLNR but when creating the join no records are dispalyed beacuse the values of this field in both tables are not the same.
    There are also other fields available in BKPF but the char length is not the appropriate.
    Does anyone have any idea how I can link these two tables?
    Thank you

    Neither  of these combinations  is possible with QuickViewer because the fields need to have the same length of characters in order to create the join.
    VBRK - VBLEN char(10) and BKPF - AWKEY char(20)
    VBRK -ZUONR char(18)     BKPF- BELNR char (10)
    Any other idea?
    Thank you, JP

  • Joining two tables LIKP and VBUK

    HI,
    I want to join two tables LIKP and VBUK, can u give some explaination ?
    points will be given for good answers...
    regards
    Vijaya

    Hi,
    see this example of joining two tables zairln & zflight.
    These 2 tables are logically joined by the airln field.
    Select a~airln
           a~lnnam
           b~fligh
           b~cntry
    Into table int_airdet
    From zairln as a inner join zflight as b on aairln = bairln.
    In order to restrict the data as per the selection criteria, a where clause can be added to the above inner join.
    rgds,
    latheesh
    Message was edited by: Latheesh Kaduthara

  • How to make a PDF embedded image append a report and send via fax electronically from MS SSRS 2012?

    How can I make a PDF embedded image append a SSRS 2012 report and send via fax all electronically?  Is this possible?
    Thanks in advance for your time!

    Hello,
    1. The report item Image can be used to display the image which  embedded in the report, stored in a database, stored on the report server, or stored elsewhere on the Web.
    For example, you can embedded the PDF image in the report and stored as text in the report definition.
    2.Reporting Services includes an e-mail delivery extension and a file share delivery extension which you can send report to user or group through e-mail or send the report to a shared location on your network.
    If you want to send the report to FAX, you may try to create a custom delivery extension depend on your faxing software.
    Reference:Implementing a Delivery Extension
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • Lock and Send via the Spreadsheet Add-in

    I have a question regarding lock and sending via the spreadshet add-in. When we perform this action we understand that existing data values are overwritten. Is there a setting that says to add to existing data values when we perform the lock and send?

    no, lock and send just does an overwrite. you would have to either create custom code or use something like Dodeca to do it

  • Encrypt file and send via email

    Hi,
    I have a file which I wish to encrypt and send via email. I know how to send by email but wish to send the file (csv), protected. I have read a few boards that say you could zip the file and add password protection. But sadly none of the forums show how to do this, does anyone have any code examples of what packages I would need?
    Any help would be greatly appreciated.

    See the JavaMail Third Party Products list at http://java.sun.com/products/javamail/Third_Party.html.
    Bouncy Castle is a popular package to handle secure email.

  • How to transfer file from PC to PC via serial port using labview

    I need to transfer files(.txt, .doc, .xls) from PC to PC via serial port using LabVIEW. Is it possible to transfer files, if so how to transfer?
    Solved!
    Go to Solution.

    Yes, it is possible to transfer files with the serial port using LabVIEW.  Files are just collections of bytes and the serial port is pretty good at shipping bytes from one PC to another.  You need to connect the serial ports together with a null modem cable.
    First, take a look at the example for serial communication.   In LabVIEW, go to the Help menu and select "Find Examples...".  From there you can search for "serial" or navigate to Hardware Input and Output >> Serial.  Select the "Basic Serial Write and Read.vi".  Experiment with that example to gain confidence on the serial communication methods.
    Next, it's time to learn about how to read and write files.  For that, the examples could be somewhat confusing since they all deal with files that are presumed to have data of a specific type in them.  I would recommend just getting familiar with the functions on the File I/O palette.  Specifically, get to know the following functions.
    Open/Create/Replace File - On your destination side, you'll need to create the copy of the file that you are trying to transfer
    Close File - When you are finished reading from or writing to a file, you should close it.  It cleans up the memory being used and finalizes any write operations that are still floating in the write buffer.
    Read From Binary File - The best way to read from a file when you do not really care what type of file it is.  In your case, you just want to get those bytes read and sent out so they can be written down at the destination.
    Write to Binary File - At the destination side, this is what will store those bytes to the file you created with number 1.
    Get File Size (under the Advanced File Functions sub-palette) - You need to know how big the file is so you know when you are finished.
    OK, so once you are able to create files, write bytes to them, and read bytes from existing files you can move on to transferring.
    The basic method I would suggest is to have the user specify a source file on the source PC and a destination folder on the destination PC.  Then, find out the size of the source file using number 5.  Divide that size number by the number of bytes you feel like transferring at once.  The serial buffers are usually around 32k (if I remember correctly) so do not exceed that.  Now begin sending data by reading some number of bytes and wiring that string output to the VISA Write function.  On the destination side, you'll want to be monitoring the serial port for bytes and reading them when they arrive.  Wire that string to the Write to Binary File function to add them to your destination file.
    That is the basic outline of how to do it.  You have to be careful not to overload the write and read buffers on the serial ports.  Initially you can use delays on the sending side to make sure the reading side has enough time to digest.  To get things moving faster, you can bring in some flow control.
    If all that sounds a bit intimidating, there are Alliance Member companies out there (such as PrimeTest Automation) who can write such code for you and even provide a turnkey solution for you.
    Happy wiring,
    Dan Press
    Certified LabVIEW Architect
    PrimeTest Automation

  • Files via serial port

    I need to send a jpg file via serial port. Have anyone an idea how to get it. I am using LabView 6.0.

    Hi Francesc,
    In order to solve this you will need:
    - a null modem cable (the difference is that pin 2in goes to pin 3out and pin 3in goes to pin 2out)
    - a normal serial communication VI (you can use the one in lv\examples)
    - to pass the data you have to transform your array of bytes (your file) in string at sender and reverse this operation at receiver. THE ONLY PROBLEM is with ASCII character 11 (even if the receiver has all your bytes in buffer it seems that will return to you just those before ASCII 11). Thus, you will have to avoid the transmission of this character. An idea will be to split each byte from file in other two for transmission - for example its hex code (so, 11 will be transmitted as 0B ). Of course, this method doubles the number of transmit
    ted bytes. If somebody found a better solution, please let me know.
    good luck

  • RMI via serial port.

    I would like to use RMI via serial port.
    How can I do that?

    Thanks for the reply
    I can get it sending bytes of info from one machine to
    another but not to sure how I still send an object
    Wy do you think I should'nt be sending an object using
    rmiOK, if you have a setup working that involves writing bytes to an OutputStream at one end, and reading bytes from an InputStream at the other, then all you need to do is create an ObjectOutputStream at one end, and write the object to it.
        ObjectOutputStream oos = new ObjectOutputStream(myOutputStream);
        oos.writeObject(myObjectToSend);
        oos.close();and at the other end an ObjectInputStream:
        ObjectInputStream ois = new ObjectInputStream(myInputStream);
        MyObjectType myObjectToReceive = (MyObjectType) ois.readObject();
        ois.close();That should pretty much do it.
    The reason you should not be using RMI for this is that it relies on the existence of a netork layer that connects the two machines. PPP would have provided that, but there just doesn't seem a justification for that level of complexity here.
    Sylvia.

  • How can i browse FP 2000 via serial port same use Ethernet port(RJ 45)?

    I am a new user for  labview.I develope my program with FP 2000 but I have some problem
      1 How can i browse FP 2000 via serial port same use Ethernet port(RJ 45)? if it can Tell me please.
      2 If  I use GSM/GPRS modem via FP 2000 rs 232 port (I under stand how to send AT command) and leave it stand alone
         Can I dial modem and browse file in FP 2000 same as use Ethernetport?
    Someone please help me.Thank you very much.

    Hi!
        First, I can say that your project involves many things, I cannot describe all features in the forum, and I'm not used with GPRS modems (my modems are base band serial modems...).
        Anyway, I would say that in your project you should proceed like this:
          1) Configure your FP 2000 module via MAX and ethernet connection;
          2) Download an embedded application to your module (build in LabView Real-Time)
          3) In your application, you should build a kind of serial port manager, and by the means of serial port you send/receive commands from PC.
        The commands from PC can include "Tell me the about the FP 2000 file system ", or "switch on line X", or anything you need.
       I think it would be difficult to use Internet exp, because you use IE with TCP/IP, and TCP/IP is over ethernet.
       I know that for Windows you can find some wrappers that make you "see" the serial port as an ethernet, but these wrapper do not exist under filed Point, and you shoul build one yourself!!!(and that's not easy).
        For example, to browse your files, you should build a VI that searches through your file system, and reports, via serial, the files present in a directory (it's an example....).
        About communication between GPRS modems and FP2000, I know nothing.  I suppose that these modems accept serial inputs, so you'll have to configure your serial port on FP 2000 with the correct baud rate, parity, and so on..... and you send your data to the modem.  The modem will transfer data in its way, no matter on how it does.
        To send data to your modem you shoud take a look to some Serial communication examples.  What I suggest you, first, is to connect the serial port of FP2000 to a PC, and test communication between PC and FP2000, without modems. Just direct cable connection!  If you're able to do this, insertion of modems is the next step, and should be quite easy.  If you're not able to make the PC receive strings of data from FP2000, over  RS232, adding modems is a further complication, and you won't come out of this mess!
       So, what I say, is just build, for now, a simple embedded application for FP2000, that, using RS232, sends data to a PC (you should see data sent with use of Hyper terminal).
        To build this application, use Instrument I/O --> VISA commands (VISA open, VISA write, and Property node should be enough, for now).
       Please, let me know if this helps......
        Have a nice (programming) day!
    graziano

  • Problem communicating via serial port in Linux

    Hello,
    I am trying to transfer data via serial port, in Linux.
    But it is impossible till now!
    I get Runtime exception.
    Here is my code:
    public class Main {
        public Main() {
        int num=5;
        int[] array = new int[5];
        public static void main(String args[])  {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    array[0]=1;
                    array[1]=2;
                    array[2]=3;
                    array[3]=4;
                    array[4]=5;
                    new ParallelCommunication(num,array);
    import java.io.*;
    import java.util.*;
    import javax.comm.*; // for SUN's serial/parallel port libraries
    //import gnu.io.*; // for rxtxSerial library
    public class ParallelCommunication implements Runnable, SerialPortEventListener {
       static CommPortIdentifier portId;
       static CommPortIdentifier saveportId;
       static Enumeration portList;
       InputStream inputStream;
       SerialPort serialPort;
       Thread readThread;
       static OutputStream outputStream;
       static boolean outputBufferEmptyFlag = false;
       int num;
       int[] array;
       public ParallelCommunication(int this_num,int[] this_array) {
          boolean portFound = false;
          String defaultPort;
          num = this_num;
         array=new int[this_array.length];     
          array = this_array;     
          // determine the name of the serial port on several operating systems
          String osname = System.getProperty("os.name","").toLowerCase();
          if ( osname.startsWith("windows") ) {
             // windows
             defaultPort = "COM1";
          } else if (osname.startsWith("linux")) {
             // linux
            defaultPort = "/dev/ttyS0";
          } else {
             System.out.println("Sorry, your operating system is not supported");
             return;
    //      if (args.length > 0) {
    //         defaultPort = args[0];
          System.out.println("Set default port to "+defaultPort);
          // parse ports and if the default port is found, initialized the reader
          portList = CommPortIdentifier.getPortIdentifiers();
          while (portList.hasMoreElements()) {
             portId = (CommPortIdentifier) portList.nextElement();
             if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
                if (portId.getName().equals(defaultPort)) {
                   System.out.println("Found port: "+defaultPort);
                   portFound = true;
                   // init reader thread              
                   initialize();
                   break;
          if (!portFound) {
             System.out.println("port " + defaultPort + " not found.");
       public void initwritetoport() {
          // initwritetoport() assumes that the port has already been opened and
          //    initialized by "public void initialize()"
          try {
             // get the outputstream
             outputStream = serialPort.getOutputStream();
          } catch (IOException e) {}
          try {
             // activate the OUTPUT_BUFFER_EMPTY notifier
             serialPort.notifyOnOutputEmpty(true);
          } catch (Exception e) {
             System.out.println("Error setting event notification");
             System.out.println(e.toString());
             System.exit(-1);
       public void writetoport(int counter) {
          try {
             // write string to serial port
             outputStream.write(String.valueOf(array[counter]).getBytes());
          } catch (IOException e) {}
       public void initialize() {
          // initalize serial port
          try {
             serialPort = (SerialPort) portId.open("SimpleReadApp", 2000);
          } catch (PortInUseException e) {System.out.println("Port In Use.");}  //******Here is the Exception******
          try {
             inputStream = serialPort.getInputStream();
          } catch (IOException e) {}
          try {
             serialPort.addEventListener(this);
          } catch (TooManyListenersException e) {}
          // activate the DATA_AVAILABLE notifier
          serialPort.notifyOnDataAvailable(true);
          try {
             // set port parameters
             serialPort.setSerialPortParams(9600, SerialPort.DATABITS_8,
                         SerialPort.STOPBITS_1,
                         SerialPort.PARITY_NONE);
          } catch (UnsupportedCommOperationException e) {}
          // start the read thread
          readThread = new Thread(this);
          readThread.start();
       public void run() {
          // first thing in the thread, we initialize the write operation
         initwritetoport();     
         for(int i=0; i<=num_of_inputs; i++) {
            // write string to port, the serialEvent will read it
            writetoport(i);
         serialPort.close();     
       public void serialEvent(SerialPortEvent event) {
          switch (event.getEventType()) {
          case SerialPortEvent.BI:
          case SerialPortEvent.OE:
          case SerialPortEvent.FE:
          case SerialPortEvent.PE:
          case SerialPortEvent.CD:
          case SerialPortEvent.CTS:
          case SerialPortEvent.DSR:
          case SerialPortEvent.RI:
          case SerialPortEvent.OUTPUT_BUFFER_EMPTY:
             break;
          case SerialPortEvent.DATA_AVAILABLE:
             // we get here if data has been received
             byte[] readBuffer = new byte[20];
             try {
                // read data
                while (inputStream.available() > 0) {
                   int numBytes = inputStream.read(readBuffer);
                // print data
                String result  = new String(readBuffer);
                System.out.println("Read: "+result);
             } catch (IOException e) {}
             break;
    }...and the outcome is :
    Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException:
    Error opening "/dev/ttyS0"
    tcgetattr(): Input/output error
    at com.sun.comm.LinuxDriver.getCommPort(LinuxDriver.java:66)
    at javax.comm.CommPortIdentifier.open(CommPortIdentifier.java:369)
    at ParallelCommunication.initialize(ParallelCommunication.java:128)
    I have searched a lot and I couldn't find a solution.
    Thank you.

    I'm having the same problem this helped somewhat debug the problem
    http://bloggerdigest.blogspot.com/2006/11/linux-serial-com-port-diagnostic-test.html
    I'm running Suse 10.3 and apparently it does not recognize my serial ports. So before
    you can test your Java code you have to figure out how to make linux see the ports.
    If I find a solution I'll let you know but if you find one first let me know. Thanks.

  • Export CDR via serial port

    The hardware platform is Cisco UCSC-C220-M3SBE, the Call Manager version is 8.6.2.22900-9.
    We manage to export the CDR to a sftp server. However, the bill system vendor requests us to export the CDR via serial port. 
    Is it possible to do it onto our platform in this case?

    On CUCM no, but with CME it can be done (by collecting syslog output). Otherwise you may exploit the CDRs on the voice gateway.
    It's not everytime that CUCM offers the required feature!

  • Connection Siemens TC65 to PC via serial port

    I don't connect Siemens TC65 via serial port . How can I do this? How can I upload java code in tc65..
    Is there anyone to solve this problem?

    tajava
    Welcome to the forum. Please refrain from posting in old threads that are long dead. When you have a question, please start a topic of your own. Feel free to provide a link to an old thread if relevant.
    I also suggest you go through these links before posting again:
    [How to ask questions the smart way|http://catb.org/~esr/faqs/smart-questions.html]
    [How To Get Good Answers To Your Questions|http://www.tek-tips.com/viewthread.cfm?qid=473997]
    I'm locking this thread now.
    db

  • I want to send 10 bit ADC from PIC via serial communicaton. i send it separetly 8 bit first then the other 2 bit. how to program in labview to capture those two packet then combine it togother

    i want to send 10 bit ADC from PIC mCu via serial communicaton.
     i send it separetly 8 bit first then the other 2 bit (2 bit --> with zero at 6 bit from LSB).
    how to program in labview to capture those two packet and then combine it together
    so i have 10 bit in lab view
    thank you

    Close, but now quite. You need to specify to the VISA Read how many bytes to read, not how many bits. Thus, the input would be 2, not 16. It's also not clear why you're trying to use the "String to Byte Array". The Type Cast will give you a number based on what data type you wired. You're basically telling it how to interpret the string. In this case we're telling it to interpret the string a 16-bit value, so we'll get a 16-bit integer. I know you said you wanted a 10-bit, but you can't have that. You'll get a 16-bit with 6 bits set to zero. Note: I did not completely understand what you said so we may need to change this slightly, but we want to get the communication and reading collection working first.
    Also, since you seem to be setting this in a loop you probably want to monitor this or to collect the data. For that you need a shift register. See attached for a modified version of your attempt. You need to set the datatype to I16 or U16 based on whether the value you get from the PIC is signed or unsigned.
    Message Edited by smercurio_fc on 05-01-2007 02:28 PM
    Attachments:
    Read PIC.vi ‏21 KB
    Read PIC.png ‏7 KB

  • How to ZIP file and send via SMTP in Oracle

    Dear All,
    I want to send data every month via email where the data i got from view.
    The problem is the file is to big, so i should zip it.
    the question is How i can perform it with procedure and send it automatically via Job every 1st month
    what i've done was i create a procedure to make the file in zip
    [quote/]
    CREATE OR REPLACE PROCEDURE production.CREATE_EXCEL_DTKPITerminate IS
        vvrun varchar2(3000);
        vsender varchar2(100);
        vrecepient varchar2(100);
      vccrecipient varchar2(1000);
        vsubject varchar2(1000);
        vmessage long;
        v_loc varchar2(5);
       NAME:       CREATE_EXCEL
       PURPOSE:
       REVISIONS:
       Ver        Date        Author           Description
       1.0        10/15/2012          1. Created this procedure.
       NOTES:
       Automatically available Auto Replace Keywords:
          Object Name:     CREATE_EXCEL
          Sysdate:         10/15/2012
          Date and Time:   10/15/2012, 9:42:40 , and 10/15/2012 9:42:40
          Username:         (set in TOAD Options, Procedure Editor)
          Table Name:       (set in the "New PL/SQL Object" dialog)
    begin
       vsender := '[email protected]';
         vrecepient := '[email protected]';
      vccrecipient := '[email protected]';
         vsubject := 'KPI Terminate'||TO_CHAR(SYSDATE,'MM-YYYY');
         vmessage :=
            'MESSAGE .';
         as_xlsx.query2sheet('
         select cmp_company,emp#,name,class,goucode,goudesc,job,job_name,tglkeluar
                ,nac_seq,nac_code,nac_type,nac_begin,nac_desc,reason,reason_code
                from V_KPITerminate
         --insert into blobs(blob_id,blob_name)
         --values (1,as_xlsx.finish);
         SEND_SMTP_PUZZLE_DTKRY(vsender,vrecepient,vccrecipient,vsubject,vmessage,as_xlsx.finish,'DataKPITerm -'||to_char(sysdate,'yyyy')||'.zip');
      --as_xlsx.save( 'BASE_DIR3', 'SWT.xls' );
    end;
    [/quote]
    when i execute this, Error ocured
    Message       : ORA-29278: SMTP transient error: 421 Service not available
    ORA-06512           : at "SYS.UTL_SMTP", line 21
    ORA-06512           : at "SYS.UTL_SMTP", line 97
    ORA-06512           : at "SYS.UTL_SMTP", line 399
    ORA-06512           : at "PU22PROD_123.SEND_SMTP_PUZZLE_DTKRY", line 151
    ORA-29294           : A data error occurred during compression or uncompression.
    ORA-06512           : at "PU22PROD_123.CREATE_EXCEL_KPITERM", line 60
    ORA-06512           : at line 2
    cann anyone help?
    the data is too big so i prefer it zip.. can anyone help..
    the SMTP I use is like this
    CREATE OR REPLACE PROCEDURE production.SEND_SMTP_PUZZLE_DTKRY (pSender VARCHAR2,pRecipient VARCHAR2, pCCRecipient VARCHAR2, pSubject VARCHAR2,pMessage LONG,pattach BLOB,pfilename VARCHAR2) IS
      v_src_loc  BFILE := BFILENAME('BASE_DIR3', 'pajak.xls');
          l_buffer   RAW(54);
          l_amount   BINARY_INTEGER := 54;
         l_pos      INTEGER := 1;
         l_blob     BLOB := EMPTY_BLOB;
         l_blob_len INTEGER;
          v_amount   INTEGER;
          crlf CONSTANT VARCHAR2(2):= CHR(13) || CHR(10);
      v_connection_handle  UTL_SMTP.CONNECTION;
        v_smtp_host          VARCHAR2(30) := 'mail.mayora.co.id'; --My mail server, replace it with yours.
        v_subject            VARCHAR2(30) := 'Your Test Mail';
        l_message            VARCHAR2(200) := 'This is test mail using UTL_SMTP';
      pcc varchar2(50);
      i number := 1;
      j number := 1;
      l_original_blob blob;
      l_compressed_blob blob;
    BEGIN
       BEGIN
         /*Preparing the LOB from file for attachment. */
         --DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
         --dBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
         --v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
         --DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
         --l_blob_len := DBMS_LOB.getlength(l_blob);
      l_original_blob     := pattach;
         l_compressed_blob   := TO_BLOB('1');
      UTL_COMPRESS.lz_compress (src => l_original_blob,
                                   dst => l_compressed_blob);
      --DBMS_LOB.FREETEMPORARY(l_compressed_blob);
      l_blob := l_compressed_blob;
         l_blob_len := DBMS_LOB.getlength(l_blob);
         /*UTL_SMTP related coding. */
         v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host);
         UTL_SMTP.HELO(v_connection_handle, v_smtp_host);
         UTL_SMTP.MAIL(v_connection_handle, psender);
         UTL_SMTP.RCPT(v_connection_handle, precipient);
        if pCCRecipient is not null then
            if(instr(pCCRecipient,',') = 0) then
            utl_smtp.rcpt(v_connection_handle, pCCRecipient);
            else
           while(instr(pCCRecipient,',',i) > 0)
            loop
            pcc := substr(pCCRecipient,i, instr(substr(pCCRecipient,i),',')-1);
            i := i+instr(substr(pCCRecipient,i),',');
            utl_smtp.rcpt(v_connection_handle,pcc);
            end loop;
            pcc := substr(pCCRecipient,i,length(pCCRecipient));
            utl_smtp.rcpt(v_connection_handle,pcc);
            end if;
        end if;
         --UTL_SMTP.RCPT(v_connection_handle, v_cc_email_address);
         UTL_SMTP.OPEN_DATA(v_connection_handle);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                               'FROM' || ': ' ||  psender || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                               'TO' || ': ' ||  precipient || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                               'CC' || ': ' ||  pCCRecipient || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                               'SUBJECT' || ': ' ||  pSubject || UTL_TCP.CRLF);
       --MIME header.
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'MIME-Version: 1.0' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             ' boundary= "' || 'BASE_DIR3.SECBOUND' || '"' ||
                             UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
         -- Mail Body
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             '--' || 'BASE_DIR3.SECBOUND' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'Content-Type: text/plain;' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             ' charset=US-ASCII' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle, Pmessage || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
         -- Mail Attachment
       UTL_SMTP.WRITE_DATA(v_connection_handle,
                             '--' || 'BASE_DIR3.SECBOUND' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'Content-Type: application/octet-stream' ||
                             UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             ' filename="' || pfilename || '"' || --My filename
                             UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
       /* Writing the BLOL in chunks */
         WHILE l_pos < l_blob_len LOOP
           DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
           UTL_SMTP.write_raw_data(v_connection_handle,
                                  UTL_ENCODE.BASE64_ENCODE(l_buffer));
           UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
           l_buffer := NULL;
           l_pos    := l_pos + l_amount;
        END LOOP;
         UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
         -- Close Email
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             '--' || 'BASE_DIR3.SECBOUND' || '--' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
         UTL_SMTP.CLOSE_DATA(v_connection_handle);
         UTL_SMTP.QUIT(v_connection_handle);
      EXCEPTION
        WHEN OTHERS THEN NULL;
        --return 1;
          UTL_SMTP.QUIT(v_connection_handle);
          RAISE;
      END;
    END;

    this is my smtp procedure
    CREATE OR REPLACE PROCEDURE PROD.SEND_SMTP_PUZZLE_DTKRY (pSender VARCHAR2,pRecipient VARCHAR2, pCCRecipient VARCHAR2, pSubject VARCHAR2,pMessage LONG,pattach BLOB,pfilename VARCHAR2) IS
      v_src_loc  BFILE := BFILENAME('BASE_DIR3', 'pajak.xls');
          l_buffer   RAW(54);
          l_amount   BINARY_INTEGER := 54;
         l_pos      INTEGER := 1;
         l_blob     BLOB := EMPTY_BLOB;
         l_blob_len INTEGER;
          v_amount   INTEGER;
          crlf CONSTANT VARCHAR2(2):= CHR(13) || CHR(10);
      v_connection_handle  UTL_SMTP.CONNECTION;
        v_smtp_host          VARCHAR2(30) := 'mail.mayora.co.id'; --My mail server, replace it with yours.
        v_subject            VARCHAR2(30) := 'Your Test Mail';
        l_message            VARCHAR2(200) := 'This is test mail using UTL_SMTP';
      pcc varchar2(50);
      i number := 1;
      j number := 1;
      l_original_blob blob;
      l_compressed_blob blob;
    BEGIN
       BEGIN
         /*Preparing the LOB from file for attachment. */
         --DBMS_LOB.OPEN(v_src_loc, DBMS_LOB.LOB_READONLY); --Read the file
         --dBMS_LOB.CREATETEMPORARY(l_blob, TRUE); --Create temporary LOB to store the file.
         --v_amount := DBMS_LOB.GETLENGTH(v_src_loc); --Amount to store.
         --DBMS_LOB.LOADFROMFILE(l_blob, v_src_loc, v_amount); -- Loading from file into temporary LOB
         --l_blob_len := DBMS_LOB.getlength(l_blob);
      l_original_blob     := pattach;
         l_compressed_blob   := TO_BLOB('1');
      UTL_COMPRESS.lz_compress (src => l_original_blob,
                                   dst => l_compressed_blob);
      --DBMS_LOB.FREETEMPORARY(l_compressed_blob);
      l_blob := l_compressed_blob;
         l_blob_len := DBMS_LOB.getlength(l_blob);
         /*UTL_SMTP related coding. */
         v_connection_handle := UTL_SMTP.OPEN_CONNECTION(host => v_smtp_host);
         UTL_SMTP.HELO(v_connection_handle, v_smtp_host);
         UTL_SMTP.MAIL(v_connection_handle, psender);
         UTL_SMTP.RCPT(v_connection_handle, precipient);
        if pCCRecipient is not null then
            if(instr(pCCRecipient,',') = 0) then
            utl_smtp.rcpt(v_connection_handle, pCCRecipient);
            else
            while(instr(pCCRecipient,',',i) > 0)
            loop
            pcc := substr(pCCRecipient,i, instr(substr(pCCRecipient,i),',')-1);
            i := i+instr(substr(pCCRecipient,i),',');
            utl_smtp.rcpt(v_connection_handle,pcc);
            end loop;
            pcc := substr(pCCRecipient,i,length(pCCRecipient));
            utl_smtp.rcpt(v_connection_handle,pcc);
            end if;
        end if;
         --UTL_SMTP.RCPT(v_connection_handle, v_cc_email_address);
         UTL_SMTP.OPEN_DATA(v_connection_handle);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                               'FROM' || ': ' ||  psender || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                               'TO' || ': ' ||  precipient || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                               'CC' || ': ' ||  pCCRecipient || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                               'SUBJECT' || ': ' ||  pSubject || UTL_TCP.CRLF);
         --MIME header.
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'MIME-Version: 1.0' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'Content-Type: multipart/mixed; ' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             ' boundary= "' || 'BASE_DIR3.SECBOUND' || '"' ||
                             UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
         -- Mail Body
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             '--' || 'BASE_DIR3.SECBOUND' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'Content-Type: text/plain;' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             ' charset=US-ASCII' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle, Pmessage || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
         -- Mail Attachment
       UTL_SMTP.WRITE_DATA(v_connection_handle,
                             '--' || 'BASE_DIR3.SECBOUND' || UTL_TCP.CRLF);
        UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'Content-Type: application/octet-stream' ||
                             UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'Content-Disposition: attachment; ' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             ' filename="' || pfilename || '"' || --My filename
                             UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             'Content-Transfer-Encoding: base64' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
       /* Writing the BLOL in chunks */
         WHILE l_pos < l_blob_len LOOP
           DBMS_LOB.READ(l_blob, l_amount, l_pos, l_buffer);
           UTL_SMTP.write_raw_data(v_connection_handle,
                                  UTL_ENCODE.BASE64_ENCODE(l_buffer));
           UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
           l_buffer := NULL;
           l_pos    := l_pos + l_amount;
        END LOOP;
         UTL_SMTP.WRITE_DATA(v_connection_handle, UTL_TCP.CRLF);
         -- Close Email
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             '--' || 'BASE_DIR3.SECBOUND' || '--' || UTL_TCP.CRLF);
         UTL_SMTP.WRITE_DATA(v_connection_handle,
                             UTL_TCP.CRLF || '.' || UTL_TCP.CRLF);
         UTL_SMTP.CLOSE_DATA(v_connection_handle);
         UTL_SMTP.QUIT(v_connection_handle);
      EXCEPTION
        WHEN OTHERS THEN NULL;
        --return 1;
          UTL_SMTP.QUIT(v_connection_handle);
          RAISE;
      END;
    END;
    is there a mistake?

Maybe you are looking for

  • Is there a way to change the color of the Menu Bar (Snow Leopard)?

    Without using an external program, that is. I know you can change it with an external program, but I was wondering if anyone knows how to modify it from within OS X's files themselves? A similar question might be asked about the Dock, or Snow Leopard

  • Lumia 800 turning off randomly

    hi All I'm having an odd problem with my Lumia 800, that I hope you can help with. The phone randomly shuts down, it doesn't seem to be related to the power levels as it does it when fully charged. It can go 2 days or 5 minutes before doing this. The

  • RAC Install fails with "OCR upgrade failed with (-1073741819) on 10.2.0

    I am trying to install RAC 10.2.0 with two Server 2003 R2 nodes connected to a fiber channel SAN. I have set up the shared storage, created the extended partitions, and setup the unformatted no drive letter volumes. Both servers see the unformatted v

  • Firefox seems to be very unstable with Windows 7 !!!

    here are all my firefox crashes ID : <pre><nowiki>bp-68f7dcc2-61a2-46a7-959a-355cb2100524 24/05/2010 11:25 bp-faef2b19-79c0-4750-9e7a-3eacd2100524 24/05/2010 10:12 bp-a477cc33-0f81-4347-80e2-f38712100524 24/05/2010 10:08 bp-90b1cdf9-3160-4f99-bc7c-0e

  • Trouble importing images from folders

    I tired importing photos from one folder and about 300-400 of them weren't imported (out of about 1,000).  I deleleted them and tried again. Same thing.  On the third try it imported all of them. My thought was maybe it's going to take more time impo