Thread: ISO 8583 Message Parser in C?

  1. #1
    Registered User
    Join Date
    Mar 2008
    Posts
    8

    Unhappy ISO 8583 Message Parser in C?

    Dear Friends ,
    Could you please help me to develope a ISO 8583 Message Parser in C or any body is having it .
    Thanks in advance
    Nadeer

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Searching the web shows quite a few different parsers for ISO 8583.

    We can certainly help you write your own, but we are not going to do the work for you. If that's what you want, then www.rentacoder.com is one possibility. Or the "jobs" section here.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > Could you please help me to develope a ISO 8583 Message Parser in C
    Is this the kind of ratio where you spend 1% of the effort saying "help me write a parser", and someone else does the other 99% by doing all the work?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Salem View Post
    > Could you please help me to develope a ISO 8583 Message Parser in C
    Is this the kind of ratio where you spend 1% of the effort saying "help me write a parser", and someone else does the other 99% by doing all the work?
    I expect if that's the scenario, 1% is probably a bit high for the proportion of total effort. 0.1% is probably still a bit high - the parse doesn't look extremely complicated, but I expect it will turn into several hundred if not a few thousand lines of code to do a full implementation.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Mar 2008
    Posts
    8

    Sorry my ingnorance

    We did the ISO parsing in Oracle PL/SQL , Now palnning to move to Unix/C ,
    the actual issue is , in PL/SQL the Filed lenght/Attribute/type are stored in the Table and the parser reads the table to parse the fields.
    Could please help me how ro achieve this in C
    and pl/SQL
    Here some part of it for your reference.

    Code:
    FUNCTION Convertx2b(  p_inXbit  IN VARCHAR2, p_Bbit OUT  VARCHAR2) RETURN  BOOLEAN IS
    /*=========================================================================================================
    Converting the HEX Values into Binary .
    ==========================================================================================================*/
    
      v_cur_pos       INTEGER DEFAULT 1;
      v_tot_length    INTEGER;
      v_iso_bin       VARCHAR2(4);
      v_count	  NUMBER(2):=1;
      v_cur_value     VARCHAR2(1);
    
    BEGIN
      v_tot_length := LENGTH(p_inXbit); --total length of Hexadecimal bitmap
    
      --loop through hexadecimal values and replace them one by one
      FOR i IN 2..(v_tot_length+1) LOOP
    
          v_cur_value:=SUBSTR(p_inXbit,v_COUNT,1);
          BEGIN
    	SELECT  DECODE(v_cur_value,'0', '0000',
                                       '1', '0001',
                                       '2', '0010',
                                       '3', '0011',
    	                           '4', '0100',
    	                           '5', '0101',
    	                           '6', '0110',
    	                           '7', '0111',
    	                           '8', '1000',
    	                           '9', '1001',
    	                           'A', '1010',
    	                           'B', '1011',
    	                           'C', '1100',
    	                           'D', '1101',
    	                           'E', '1110',
    	                           'F', '1111',
         		                   'ERR')
    	INTO v_iso_bin FROM dual ;
          EXCEPTION
                WHEN OTHERS THEN
                   RETURN FALSE;
          END;
          	 IF v_iso_bin <> 'ERR' THEN		--junb
    	    p_Bbit:=p_Bbit||TO_CHAR(v_iso_bin); --construct binary output
    	 ELSE
    	    RETURN FALSE;
    	 END IF;
    	    v_count:=v_count+1;
      END LOOP;
    
      RETURN TRUE; --if no errors
    END;
    
    /*====================================================================================================================
    ====================================================================================================================*/
    PROCEDURE do_initialize
      IS
      BEGIN
        FOR i IN 1..128
        LOOP
          BEGIN
            p_msgrec(i) := NULL;
          EXCEPTION
            WHEN OTHERS THEN
            	out_bds_msg := '4202';
            	RAISE e_error;
    	  END;
        END LOOP;
    END; -->>initialize End
    /*=================================================================================================================
    ====================================================================================================================*/
    
    FUNCTION CHECK_FLDS( p_Bbit IN VARCHAR2, p_data IN VARCHAR2) RETURN BOOLEAN IS
    /*===================================================================================================================
    Checking  fields in the ISO BIT Message
    =====================================================================================================================*/
    
      v_cur_pos      INTEGER DEFAULT 1;
      v_length       INTEGER;
      v_tot_length   INTEGER;
      v_len          INTEGER;
      v_iso_flds     ISO_FIELDS%ROWTYPE;
    
    BEGIN
      v_tot_length := LENGTH(p_data); --length of data part
      v_len := LENGTH(p_Bbit);        --length of binary bitmap
    
    /*loop through binary bitmap to populate fields*/
      FOR i IN 2..v_len LOOP
        IF  SUBSTR(p_Bbit,i,1)='1' THEN  --if it is 1 ,field is populated..get length.if 0 skip
    
          IF v_cur_pos > v_tot_length THEN
            p_msgrec(72) := 'END OF MESSAGE REACHED';
            RETURN FALSE;
          END IF;
          --get field properties from table
          BEGIN
            SELECT *
            INTO   v_iso_flds
            FROM   ISO_FIELDS
            WHERE  bit=i;
    
          EXCEPTION
    	      WHEN NO_DATA_FOUND THEN
    	           p_msgrec(72) := 'ISO 8583 REF TAB NOT SETUP. FLD NO.: '||TO_CHAR(i)||' ';
                 RETURN FALSE;
          END;
          --get field length
          v_length := v_iso_flds.LENGTH;
    
    --incase field format is LLVAR
          IF v_iso_flds.format='LLVAR' THEN
    
            BEGIN
              --get length of field from first 2 numbers
              v_length:=TO_NUMBER(SUBSTR(p_data,v_cur_pos,2));
            EXCEPTION
    	        WHEN VALUE_ERROR THEN
    	             p_msgrec(72) := 'NON-NUMERIC LENGTH VALUE FOR LLVAR. FIELD: '||v_iso_flds.name
                                    ||' ';
                   logData(to_char (systimestamp, 'hh24.mi.ss.ff3')||'NON-NUMERIC LENGTH VALUE FOR LLVAR. FIELD:->'||to_char(i)||v_iso_flds.name ||',CardNo'||p_msgrec(2)||'->MsgStanNo'||p_msgrec(11),'E');
    	             RETURN  FALSE;
            END;
    
            IF v_length > v_iso_flds.LENGTH THEN
              p_msgrec(72) := 'LENGTH FOR LLVAR EXCEEDS MAX. FIELD: '
                           ||v_iso_flds.name||' ';
             logData(to_char (systimestamp, 'hh24.mi.ss.ff3')||'LENGTH FOR LLVAR EXCEEDS MAX. FIELD:->'||to_char(i)||v_iso_flds.name||',CardNo'||p_msgrec(2)||'->MsgStanNo'||p_msgrec(11),'E');
              RETURN FALSE;
            END IF;
            --skip first 2 numbers since they are length of field
            v_cur_pos:=v_cur_pos+2;
    
    --incase field format is LLLVAR
          ELSIF v_iso_flds.format='LLLVAR' THEN
    
            BEGIN
              --get length of field from first 3 numbers
    	        v_length:=TO_NUMBER(SUBSTR(p_data,v_cur_pos,3));
            EXCEPTION
    	        WHEN VALUE_ERROR THEN
    	             p_msgrec(72) := 'NNUM LENGTH VAL FOR LLLVAR. FLD: '|| v_iso_flds.name||' ';
                   logData(to_char (systimestamp, 'hh24.mi.ss.ff3')||'NNUM LENGTH VAL FOR LLLVAR. FLD:->'||to_char(i)|| v_iso_flds.name||',CardNo'||p_msgrec(2)||'->MSgStanNo'||p_msgrec(11),'E');
              RETURN  FALSE;
            END;
    
    	      IF v_length > v_iso_flds.LENGTH THEN
    	         p_msgrec(72) := 'LGTH FOR LLLVAR EXCEEDS MAX. FIELD: '||v_iso_flds.name||' ';
               logData(to_char (systimestamp, 'hh24.mi.ss.ff3')||'LGTH FOR LLLVAR EXCEEDS MAX. FIELD:-> '||to_char(i)||v_iso_flds.name||',CardNo'||p_msgrec(2)||'->MsgStanNo'||p_msgrec(11),'E');
               RETURN FALSE;
            END IF;
            --skip first 3 numbers since they are length of field
        	  v_cur_pos:=v_cur_pos+3;
          END IF;
    
    
          p_msgrec(i)     :=   SUBSTR(p_data,v_cur_pos,v_length);
          v_cur_pos       :=   v_cur_pos+v_length;
    
        END IF;
      END LOOP;
    
     RETURN TRUE; --if no errors
    
    END CHECK_FLDS;

  6. #6
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,210
    The arrogance....

    Either pay someone to do your work or just do it yourself. Why would someone do this for you for free?

  7. #7
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    This is definitely in the scope of getting someone to do the work for you - moved.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  8. #8
    Registered User
    Join Date
    Mar 2008
    Posts
    8

    I am ready to pay .

    am ready pay , posted a bid in rentacoder.com.
    Nadeer

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Strange string behavior
    By jcafaro10 in forum C Programming
    Replies: 2
    Last Post: 04-07-2009, 07:38 PM
  2. Message class ** Need help befor 12am tonight**
    By TransformedBG in forum C++ Programming
    Replies: 1
    Last Post: 11-29-2006, 11:03 PM
  3. Dev-cpp - compiler options
    By tretton in forum C Programming
    Replies: 7
    Last Post: 01-06-2006, 06:20 PM
  4. Dialog Box Problems
    By Morgul in forum Windows Programming
    Replies: 21
    Last Post: 05-31-2005, 05:48 PM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM