2 Replies Latest reply: Mar 27, 2013 5:56 AM by Raguraman RSS

    TypedFML32 - 'Fchg' API returns number instead of null for Number fields

    Raguraman
      Hi,

      I use TypedFML32 instance to set request values to perform Tuxedo service call. Some of my tuxedo service has number fields, for which I've to set either null or valid number value. Problem is when I set null for that field, it sends it as default number value (i.e. 0.0). Given below the code snippet for more understanding.
      TypedFML32 myFml32 = new TypedFML32(new DynamicFldTbl("D:/fldtbl.txt", true));
      int fldIdLoanNo = myFml32.Fldid("LOAN_NO");
      System.out.println("LOAN_NO Field Type      : " + myFml32.Fldtype(fldIdLoanNo));
      System.out.println("TypedFML32.FLD_DOUBLE   : " + TypedFML32.FLD_DOUBLE);
      System.out.println("Set LOAN_NO as null");
      Double nullVal = null;
      myFml32.Fchg(fldIdLoanNo, 0, nullVal );
      System.out.println("Get LOAN_NO from Buffer : " + myFml32.Fget(fldIdLoanNo, 0));
      
      Output
      ====
      
      LOAN_NO Field Type      : 4
      TypedFML32.FLD_DOUBLE   : 4
      Set LOAN_NO as null
      Get LOAN_NO from Buffer : 0.0
      Question:

      When I set null to a Double data typed field, and read the field value, instead of null, it returns default number value. Why is this so? It is suppose to return null right? Can't I say the TypedFML32 to consider the value as object but not primitive data?

      Kind Regards
      Raghu

      Edited by: Raguraman on Mar 13, 2013 3:38 AM
        • 1. Re: TypedFML32 - 'Fchg' API returns number instead of null for Number fields
          Todd Little-Oracle
          Hi Raghu,

          I'm not sure I understand. What "value" would you like to have printed for LOAN_NO? When you assigned null to the C variable nullVal, that gave nullVal the value of 0.0. This is normal C behavior and has nothing to do with Tuxedo. Try the following:
          TypedFML32 myFml32 = new TypedFML32(new DynamicFldTbl("D:/fldtbl.txt", true));
          int fldIdLoanNo = myFml32.Fldid("LOAN_NO");
          System.out.println("LOAN_NO Field Type      : " + myFml32.Fldtype(fldIdLoanNo));
          System.out.println("TypedFML32.FLD_DOUBLE   : " + TypedFML32.FLD_DOUBLE);
          System.out.println("Set LOAN_NO as null");
          Double nullVal = null;
          myFml32.Fchg(fldIdLoanNo, 0, nullVal );
          System.out.println("Get LOAN_NO from Buffer : " + nullVal);
          You would have gotten the exact same output.

          What are you trying to accomplish? Are you trying to determine if the value was present or not? If so, you might try Fdel32 to delete the field from the FML32 buffer and when you receive the buffer check to see if the field is present or not. Since you are passing things by value and not pointer, null doesn't mean not present, it means the default value for the data type.

          Regards,
          Todd Little
          Oracle Tuxedo Chief Architect
          • 2. Re: TypedFML32 - 'Fchg' API returns number instead of null for Number fields
            Raguraman
            Thanks for the response Todd. I thought after I set null, expected null when I read. But now I understand it is because of the behavior of C for number variables. It looks like PowerBuilder Interspace interface works differently than WebLogic Tuxedo Connector. Thanks for the clarification.

            Raghu