Data type Replication and ODBC

I want to convert table that has column with LONG datatype to
supported datatype by replication. Currently the LONG column
contains more than 4,000 bytes so I can't convert to Varchar(2).
If I convert to CLOB then the application that we are using is
connecting through ODBC drivers and CLOB is not supported by
ODBC.
Is any one run into this situation? What is recommended or
practical solutions for this problem?
Thanks.
--Pravin

Thx,
I used data type java.sql.Timezone and it works fine ;) This data type parse Date to format yyyy-MM-dd hh:mm:ss, so basically does not matter if I use string or this type :) but this is better ;)
Problem is in timezone ! :( In data type java.sql.Timezone is not possible set timezone! :(

Similar Messages

  • Problem to transform Flat file to Data Type Structurated and map to IDOC

    Hi all,
    I have a file to idoc scenario.
    The information is like this:
    1#!445#!AI12#!1#!20070214#!DVXXXXR#!201#!31GINHG876#!#!
    2#!#!ETC
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    4#!dades45#!b#!c#!d#!e#!f#!g
    5#!pos5
    where 1, 2, ... = key segments for the file adapter and #! are the field separator.
    this must go to a Data Type with substructures like this:
    (xml)
    .1
    ......2
    .3
    ......4
    ......5
    where 2 is inside 1 and 4-5 inside 3.
    The reason of this is we can get unbounded replays of 3/4/5 for one header.
    But XI reads the information like if all segments are headers.
    .1
    .2
    .3
    .4
    .5
    So the IDOC is bad created.
    Where is the issue?  At Message Mapping all substructures are mapped with his default and at TEST option it works fine.
    Thanks in advance for your help.
    best regards
    Message was edited by:
            Federico Martin
    Message was edited by:
            Federico Martin

    Dear people,
    according to license problems at client, it's impossible to get the convert agent.
    so now we come back to try to solve with normal mapping.
    the next step is try to convert it using 2 message mappings: dt (flat xml) to dt (structurated) and this one to the idoc.
    i suppose it can be done adding program at interface mapping.
    I created the no hiereachical Data Type for load the information and it's fine. But i am unable to get the first mapping OK, because XI has problems with unbounded segments.
    If you agreed and has time, i copy here the information and his structure.
    I receive (#! defines separation and key segment fields are 1,2,3,4,5):
    1#!445#!AH02#!1#!20070214#!DVPOSTER#!201#!31GINHGIN0#!#!
    2#!#!ETC
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    4#!dades45#!b#!c#!d#!e#!f#!g
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    4#!dades45#!b#!c#!d#!e#!f#!g
    5#!pos5
    5#!pos5
    5#!pos5
    The destination must be:
    CHASE A
    1 (1..1)
    ....2 (1..1)
    3 (1..unbounded)
    ....4 (0..1)
    3 (1..unbounded)
    3 (1..unbounded)
    ....4 (0..1)
    5 (1..unbounded)
    5 (1..unbounded)
    5 (1..unbounded)
    CHASE B
    Or, in another case with 5 as child of 3 (like example in last mail)
    1#!445#!AH02#!1#!20070214#!DVPOSTER#!201#!31GINHGIN0#!#!
    2#!#!ETC
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    4#!dades45#!b#!c#!d#!e#!f#!g
    5#!pos5
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    5#!pos5
    3#!000000000030008888#!#!3000#!#!10#!#!20070215
    4#!dades45#!b#!c#!d#!e#!f#!g
    5#!pos5
    1 (1..1)
    ....2 (1..1)
    3 (1..unbounded)
    ....4 (0..1)
    ....5 (1..unbounded)
    3 (1..unbounded)
    ....5 (1..unbounded)
    3 (1..unbounded)
    ....4 (0..1)
    ....5 (1..unbounded)
    3 (1..unbounded)
    ....4 (0..1)
    ....5 (1..unbounded)
    Questions:
    How i do for map Data Type (no hierachical) -to-> Data Type (hierachical) and  Data Type (hierachical) -to-> IDOC? Is any loop or context object required?
    Thank you in advance for your help and sorry the long thread.

  • Sysgen : How to read the input port data type, width and rate dynamically in a masked subsystem ?

    Hello everybody,
         I am designing a general purpose block in system generator. I pass the user parameters to the block through masking it. Some user parameters can change the block configuration. The input port data type, width and rate can also affect the block configuration.
         The problem is that these values (input port data type, width and rate) are subject to change. So I should read them dynamically, then change the block configuration through programming the "Initialization Commands" field. But unfortunately there is no straight way to read the input port information.
         There are some methods in for example the "Black Box". these are:
    input_width = this_block.port('din').width;
    input_rate = this_block.port('din').rate;
    But these methods are not applicable to a masked subsystem.
    I have tried other ways also. You can find them below. None of them worked.
    Does anybody know how can I solve this problem?
    Other ways I tried:
    1)
    design_name([],[],[],'compile')                                       
    q=get_param(gcb,'PortHandles');
    get_param(q.Inport,'CompiledPortDataType')
    get_param(q.Inport,'CompiledPortWidth')
    get_param(q.Inport,'CompiledPortDimensions')
    design_name([],[],[],'term')
    2)
    ssGetInputPortDataType
    3)
    ts = Simulink.Block.getSampleTimes([gcb '/Input'])
     

    Today we rely on Simulink to perform parameterization of your designs in two ways:
    Parameterizable Subsystems and Blocks : Parameters themselves can be MATLAB expressions that need to be evaluated for which we need the MATLAB interpreter
    The very useful Rate and Type propagation or Simulink compilation that allows us to specify types & rates in one location that gets systematically propagated to all.
    To truly make the HDL Netlist that is generated from SysGen parameterizable, we would have to implement some of this capability in the HDL netlist itself by:
    Using Generics(VHDL) or Parameters(Verilog) - We would have to capture the bit width(type) propagation through levels of hierarchies and finally parameterize the IP itself based on this value
    Since IP itself does not have this capability through generics, we would have to package a separate tcl script that updates the IP parameterization appropriately in response to top level parameters(or GUI parameters)
    Interpreting MATLAB expressions and translating them into VHDL/Verilog expressions (alternatively tcl expressions of IP). In simulink, mask parameters can be passed from one level to the next. Also parameterization of a block can be composed of Matlab expressions using variables from ancestor masks & the MATLAB interpreter – so we will need to somehow capture that as well.
     

  • The data types varchar and varchar are incompatible in the subtract operator

    Hi ;
    I want to fetch values  6,903,00  format ,my query is ;
    SELECT CONVERT(varchar(50), CONVERT(money,SUM(DEBIT)),1) AS DEBIT ,CONVERT(varchar(50), CONVERT(money,SUM(CREDIT)),1),AS
    CREDIT CONVERT(varchar(50), CONVERT(money,SUM(DEBIT)),1) - CONVERT(varchar(50), CONVERT(money,SUM(CREDIT)),1) AS BALANCE
    FROM TABLE
    it was get error :  The data types varchar and varchar are incompatible in the subtract operator.
    I want to Show result ;
    DEBIT         -          CREDIT            -    BALANCE
    6,903,00              4,387.24             2,515.76
    Thanks in advance

    You have to do the subtraction with the MONEY data type (prior to covert-ing).
    Starting with SQL Server 2012, you can use the FORMAT command:
    https://msdn.microsoft.com/en-us/library/hh213505.aspx
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014
    We have to use SQL 2005 due to licensing issue .

  • Using CLOB data type - Pros and Cons

    Dear Gurus,
    We are designing a database that will be receiving comments from external data source. These comments are stored as CLOB in the external database. We found that only 1% of incoming data will be larger than 4000 characters and are now evaluating the Pros and Cons of storing only 4000 characters of incoming comments in VARCHAR2 data type or using CLOB data type.
    Some of the concerns brought up during discussion were:
    - having to store CLOBs in separate tablespace;
    - applications, such Toad require changing defaults settings to display CLOBs in the grid. Default value is not to display them;
    - applications that build web page with CLOBs will be struggling to fit 18 thousand chararcters of which 17 thousand are blank lines;
    - cashing CLOBs in memory will consume big chunk of data buffers which will affect performance;
    - to manipulate CLOBs you need PL/SQL anonymous block or procedure;
    - bind variables cannot be assigned CLOB value;
    - dynamic SQL cannot use CLOBs;
    - temp tables don't work very well with CLOBs;
    - fuzzy logic search on CLOBs is ineffective;
    - not all ODBC drivers support Oracle CLOBs
    - UNION, MINUS, INTERSECT don't work with CLOBs
    I have not delt with CLOB data type in the past, so I am hoping to hear from you of any possible issues/hastles we may encounter?

    848428 wrote:
    Dear Gurus,
    We are designing a database that will be receiving comments from external data source. These comments are stored as CLOB in the external database. We found that only 1% of incoming data will be larger than 4000 characters and are now evaluating the Pros and Cons of storing only 4000 characters of incoming comments in VARCHAR2 data type or using CLOB data type.
    Some of the concerns brought up during discussion were:
    - having to store CLOBs in separate tablespace;They can be stored inline too. Depends on requirements.
    - applications, such Toad require changing defaults settings to display CLOBs in the grid. Default value is not to display them;Toad is a developer tool so that shouldn't matter. What should matter is how you display the data to end users etc. but that will depend on the interface. Some can handle CLOBs and others not. Again, it depends on the requirements.
    - applications that build web page with CLOBs will be struggling to fit 18 thousand chararcters of which 17 thousand are blank lines;Why would they struggle? 18,000 characters is only around 18k in file size, that's not that big to a web page.
    - cashing CLOBs in memory will consume big chunk of data buffers which will affect performance;Who's caching them in memory? What are you planning on doing with these CLOBs? There's no real reason they should impact performance any more than anything else, but it depends on your requirements as to how you plan to use them.
    - to manipulate CLOBs you need PL/SQL anonymous block or procedure;You can manipulate CLOBs in SQL too, using the DBMS_LOB package.
    - bind variables cannot be assigned CLOB value;Are you sure?
    - dynamic SQL cannot use CLOBs;Yes it can. 11g supports CLOBs for EXECUTE IMMEDIATE statements and pre 11g you can use the DBMS_SQL package with CLOB's split into a VARCHAR2S structure.
    - temp tables don't work very well with CLOBs;What do you mean "don't work well"?
    - fuzzy logic search on CLOBs is ineffective;Seems like you're pulling information from various sources without context. Again, it depends on your requirements as to how you are going to use the CLOB's
    - not all ODBC drivers support Oracle CLOBs not all, but there are some. Again, it depends what you want to achieve.
    - UNION, MINUS, INTERSECT don't work with CLOBsTrue.
    I have not delt with CLOB data type in the past, so I am hoping to hear from you of any possible issues/hastles we may encounter?You may have more hassle if you "need" to accept more than 4000 characters and you are splitting it into seperate columns or rows, when a CLOB would do it easily.
    It seems as though you are trying to find all the negative aspects of CLOBs and ignoring all the positive aspects, and also ignoring the negative aspects of not using CLOB's.
    Without context you're assumptions are just that, assumptions, so nobody can tell you if it will be right or wrong to use them. CLOB's do have their uses, just as XMLTYPE's have their uses etc. If you're using them for the right reasons then great, but if you're ignoring them for the wrong reasons then you'll suffer.

  • SUS - Added Data Type Enhancement and Higher level Proxies are not active

    Hello,
    I've added a field to our current data type enhancement Z_Purchase_Order_Item.  Once I regenerate the proxy on the enhancement and activate it the field appears as it should in the high level items that use the enhancement (PurchaseOrderRequest_In).  But those proxies have become inactive and when I try to activate them I get this message:
    Interface II_BBPX1_SUS_PO was repaired before the Modification Assistant was enabled. 
    All Modification Assistant functions only apply to future modifications, not to those already
    undertaken.  This means:
    -The modification overview only displays future modifications.
    -When resetting to the standard, the system will reset all objects to their current version, since
    the actual standard can no longer be identified by the Modification Assistant.
    -Support for adjustment after an upgrade will only be available for future modifications. 
    Modifications that already exist must be re-made manually using version management.
    The next message says:
    Object can only be created in SAP package.
    Then the status bar shows "Proxy Activated".  But when I close and reopen the proxy I see that it is once again inactive. 
    Does any know what I need to do to activate this proxy? 
    Thanks,
    Matt

    In SPROXY you can open your proxy and then view the Activation Log under the GoTo menu.  The log will explain better what the problems might be.  In my case I needed to activate another data type enhancement first.
    Thanks,
    Matt

  • Object Data Type support and JDBC2 SQLData interface

    Another useful and probably easy to implement feature is to support
    persistent-aware classes based on JDBC SQLData interface._
    It will let us persist such a member of persistent class to an object
    type column._
    The interface is very simple and quite limited (no support for arrays
    etc) but useful.
    The only thing we would need is to maintain jdbc object maps for our
    database connections and tell Kodo metadata not to enhance this
    particular class member but treat is as a simple type_
    Alex

    In SPROXY you can open your proxy and then view the Activation Log under the GoTo menu.  The log will explain better what the problems might be.  In my case I needed to activate another data type enhancement first.
    Thanks,
    Matt

  • Change Date Type Description and Re Arrange

    Dear Expert,
         I would like to change description of each date type in block date and arrange date rows as new sequence in IC Web Client, I try to do it on t-code BSP_DLC_SDESIG_DL but I cannot, the transaction allow to adjust only field STRUCT.APPT_TYPE_DESCR description , I would like to change each date value description in this structure and arrange them. Have anyone used to do this? Please suggest me.
    Best Regards,
    Krin
    Edited by: Krin Thongkam on Aug 3, 2010 11:22 AM

    Hi,
    If you mean the Dates assignment block; this is populated by the date profile assigned to your transaction type.
    Go to SPRO --> CRM --> Transactions --> Basic Settings. You can find which date profile is used for your transaction type in the detailed view.
    Then go to SPRO --> CRM --> Basic Functions --> Date Management --> Define Date Profile. Here you can check which date types are used in your profile. You can rename these using SPRO --> CRM --> Basic Functions --> Date Management --> Define Date Types, Duration Types and Date Rules. I think the sequence of the dates is determined alphabetically on date type.

  • Saving result from sp_executesql into a variable and using dynamic column name - getting error "Error converting data type varchar to numeric"

    Im getting an error when running a procedure that includes this code.
    I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql
    DECLARE @retval AS DECIMAL(12,2)
    DECLARE @MonthVal VARCHAR(20), @SpreadKeyVal INT
    DECLARE @sqlcmd AS NVARCHAR(150)
    DECLARE @paramdef NVARCHAR(150)
    SET @MonthVal = 'Month' + CAST(@MonthNumber AS VARCHAR(2) );
    SET @SpreadKeyVal = @SpreadKey; --CAST(@SpreadKey AS VARCHAR(10) );
    SET @sqlcmd = N' SELECT @retvalout = @MonthVal FROM dbo.CourseSpread WHERE CourseSpreadId = @SpreadKeyVal';
    SET @paramdef = N'@MonthVal VARCHAR(20), @SpreadKeyVal INT, @retvalout DECIMAL(12,2) OUTPUT'
    --default
    SET @retval = 0.0;
    EXECUTE sys.sp_executesql @sqlcmd,@paramdef, @MonthVal = 'Month4',@SpreadKeyVal = 1, @retvalout = @retval OUTPUT;
    SELECT @retval
    DECLARE @return_value DECIMAL(12,2)
    EXEC @return_value = [dbo].[GetSpreadValueByMonthNumber]
    @SpreadKey = 1,
    @MonthNumber = 4
    SELECT 'Return Value' = @return_value
    Msg 8114, Level 16, State 5, Line 1
    Error converting data type varchar to numeric.

    Please follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
    to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for: 
    https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
    >> I need to select from a dynamic column name and save the result in a variable, but seem to be having trouble with the values being fed to sp_executesql <<
    This is so very, very wrong! A column is an attribute of an entity. The idea that you are so screwed up that you have no idea if you want
    the shoe size, the phone number or something else at run time of this entity. 
    In Software Engineering we have a principle called cohesion that says a model should do one and only one task, have one and only one entry point, and one and only one exit point. 
    Hey, on a scale from 1 to 10, what color is your favorite letter of the alphabet? Yes, your mindset is that level of sillyity and absurdity. 
    Do you know that SQL is a declarative language? This family of languages does not use local variables! 
    Now think about “month_val” and what it means. A month is a temporal unit of measurement, so this is as silly as saying “liter_val” in your code. Why did you use “sp_” on a procedure? It has special meaning in T-SQL.  
    Think about how silly this is: 
     SET @month_val = 'Month' + CAST(@month_nbr AS VARCHAR(2));
    We do not do display formatting in a query. This is a violation of at the tiered architecture principle. We have a presentation layer. But more than that, the INTERVAL temporal data type is a {year-month} and never just a month. This is fundamental. 
    We need to see the DDL so we can re-write this mess. Want to fix it or not?
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • Problem while creating with QUAN and CURR data type fields

    I am trying to create a Z table. A couple of fields are of data type QUAN and CURR, which need to have reference table and reference field.
    Field               DataType     Length     Decimal
    TOT_QTY       QUAN            15                 3
    PRICE              CURR             16                2
    For reference table and fields, I found a Table HRPAD23 which has a field called N_QUANTITY (15,3) that matches my TOT_QTY field's data type and it also has a field called UN_PRICE that matches my PRICE field's data type. But when I use them as reference, and try to activate the table, I get an error "combination reference table/field does not exist". How do I fix this? Can anybody help me? Thanks in advance.
    Chris
    Edited by: martin99 on Aug 18, 2011 9:16 PM

    Martin,
    I doubt that you need to add 2 extra fields in your table as suggested in the last post by John.
    Your error is very CLEAR that you seem to be use wrong combination of reference table and field.
    For QTY field,
    use ref table  -  HRPAD23.              ref field- UNIT
    OR
    ref table - VBAP                       ref field - VRKME
    For PRICE field,
    use ref table - PAD25                  ref field - KWAER
    OR
    ref table - T77REFDOC                                     ref field - CURRENCY
    It should work.
    BR,
    Diwakar

  • Line incomaptibilty betwwen RAW and CHAR data types in SAP Unicode System.

    Hi Gurus,
    I am working in SAP Unicode system.
    We have transferred the standard programs for Non-Unicode to Unicode system.
    In one standard function module, <table name> is defined in TABLES parameter as a type of TLINE structure, which has two fields - one is 132 length CHAR and other is 2 length CHAR.
    In the same function module , one subroutine is being called, for which <table name>  is passed.
    But in the FORM of subroutine, this table is defined as a type of HLINE, which has only one field - 134 length RAW data type.
    So due to confilct in data types ( CHAR and RAW ) , I am getting an error that both data types are not line compatible.
    Do i need to use casting concept to remove the error.
    Please suggest me the way to handle this.

    hi,
    declare the table as same data type.
    dont go for any other types.
    if you still want the form table as HLINE, then before the form call declare a varibale with TLINE data type pass the values to HLINE.
    i think this will be little complex, because again it will be type incompatablity.
    we can forcefully pass the values to HLINE with a class.
    but i think no need, declaring with same data type might be easy.
    Thanks
    Vinod

  • Mixing ESR Data type and XSD Objects

    Dear PI forum users,
    I have created some XSD containing complex types and thus "acting" as data types.
    I would like to use such a complex type defined in XSD in an ESR Data type object.
    But when I use the search help in the type column, i can only see other data types objects and not complex types defined in External definition objects.
    Do you know if what I want to do is possible and how ?
    Thanks a lot.
    Jean-Charles

    Hi,
    i can only see other data types objects and not complex types defined in External definition objects.
    This is because only datatypes are shown in the search help. It is not possible to reference an external definition in a data type.
    What you can do is:
    1.) Recreate the complex types found your external definition as a data type, and reference it in your main data type
    or
    2.) Encode the data types into your external definition (cleaner)
    Hope this helps,

  • About data type and cur/unit

    Hello Gurus,
         (1) in flat file data source,  all the data type are char originally.  should I change them to corresponding data type ?
        (2) for cur/unit, how to set ?
    Many thanks,
    Frank Zhang

    Hi...
    (1) in flat file data source, all the data type are char originally. should I change them to corresponding data type ?
    It depends on ur requirement...........Specify the data types according to the fields that you want to upload from the flat file.........If the data for your flat file was staged from an SAP system..... there are no problems when transferring data types into BI...........Please note that you might not be able to load the data types DEC and QUAN for flat files with external data............ Specify type CHAR for these data types in the transfer structure........... When you load...... these are then converted into the data type...... which you specified in the maintenance of the relevant InfoObject in BW.........
    2) for cur/unit, how to set ?
    U can define the unit/currency in the key figure............ Either the key figure has a fixed unit/currency  or the unit/currency  comes from a characteristic....... If the key figure does not have a fixed unit you can determine this........
    Suppose u r creating a keyfigure Amount.........In the Type/unit Tab........in Type/Data Type choose Amount..........Then in the Data Type ...........Choose Currency..........If u hav any Fixed Currency.....eg : EUR............put it in the firld.......Fixed currency.........otherwise if variable..........then put 0CURRENCY in the field Unit / currency..................same setting can be done for Quantity also.......
    Hope this helps.......
    Regards,
    Debjani........

  • How to handle "Variant" data type?

    I am using SQL 2000, and want to use "Variant" data type. Can I handle it in java with ODBC connection? What classes and methods need I use? Thanks a lot.

    ODBC does not have a notion of variant types. This limits the use of the sql_variant data type with an ODBC driver in SQL Server 2000. In SQL Server 2000, if binding is specified, the sql_variant data type must be bound to one of the documented ODBC data types.
    (Quote from http://msdn.microsoft.com/library/en-us/odbcsql/od_6_020_28yr.asp )
    Possible solutions:
    - CAST or CONVERT the datatype to another suitable data type in the query
    OR
    - Retrieve the column as a binary stream

  • Arrays of Different Data Types

    Hi, I am studing Java Development as 2 of my units (Programming Theory and Programming Practice), and I have a problem with a program which involves an array that contains two data types; int and long. The program is designed to store Student ID's and Exam Marks (1 Exam Mark per ID). The program is designed to use sorting, and the array is to be populated at the start of program execution. It compiles fine, but I get an error when the program is running as soon as you input the first value. The program is not very complex, but I need to understand how to get this fixed and why is isn't already. Any help is appreciated as this is a genuine problem. This program follows a consistent style template given to me by my tutor. The source is given below, and I appreciate any positive response.
    Thanks in advance...
    Aaron
         Name: Aaron Allport ([email protected])
         Assignment Number: 7
         Program Title/Topic: Student Marks/ID's with use of Array's
         Program Description: Using arrays and search/sort methods,
                                  write a program that keeps a record of
                                  students on a module, and allows the
                                  data to be manipulated.
         Course Title/Unit: BTEC National in Computing
    import javax.swing.JOptionPane;
    class StudentRecord
         int mark;
         long sID;
    public class Assignment7
         public static void main(String args[])
              final int numOfStudents = 11;
              String highestMark;
              String lowestMark;
              String examMark;
              long studentID = 00000000;
              String menuChoice;
              StudentRecord module[] = new StudentRecord[numOfStudents];
              inputRecords(module, numOfStudents);
              do
              menuChoice = JOptionPane.showInputDialog(null,
                   "STUDENT MODULE MARKS\n\n" +
                   "1. Find student with highest mark\n" +
                   "2. Find student with lowest mark\n" +
                   "3. Find grade for a given student\n" +
                   "4. Sort records by Student ID\n" +
                   "5. Sort records by Student Mark\n" +
                   "6. Display all records");
                        if (menuChoice.equals("1"))
                             highestMark = findHighest(module, numOfStudents);
                        else if (menuChoice.equals("2"))
                             lowestMark = findLowest(module, numOfStudents);
                        else if (menuChoice.equals("3"))
                             examMark = findGrade(module, numOfStudents, studentID);
                        else if (menuChoice.equals("4"))
                             studentIDSort(module, numOfStudents);
                             displayData(module, numOfStudents);
                        else if (menuChoice.equals("5"))
                             markSort(module, numOfStudents);
                             displayData(module, numOfStudents);
                        else if (menuChoice.equals("6"))
                             displayData(module, numOfStudents);
                   } while (menuChoice.equalsIgnoreCase("Q") == false);     
                   System.exit(0);
         public static void inputRecords(StudentRecord module[], int numOfStudents)
              int i;
              String inputMark;
              String inputStudentID;
              for (i = 1; i < numOfStudents; i++)
                   module[ i] = new StudentRecord();
                   inputStudentID = JOptionPane.showInputDialog(null,
                                       "Please enter Student ID for position " + i + ":");
                   module[ i].sID = Long.parseLong(inputStudentID);
                   inputMark = JOptionPane.showInputDialog(null,
                                       "Please enter Student Mark for position " + i + ":");
                   module[ i].mark = Integer.parseInt(inputMark);
         public static String findHighest(StudentRecord module[], int numOfStudents)
              int highStudentID;
              int j;
              StudentRecord temp = new StudentRecord();
              boolean intChange = true;
              int pass = 1;
              String outputMark;
              String outputSID;
              while((pass <= numOfStudents - 1) && (intChange))
                   intChange = false;
                   for (j = 1; j <= numOfStudents - pass; j++)
                        module[j] = new StudentRecord();
                        if(module[j].mark > module[j + 1].mark)
                             intChange = true;
                             temp.mark = module[j].mark;
                             temp.sID = module[j].sID;
                             module[j] = module[j + 1];
                             module[j + 1].mark = temp.mark;
                             module[j + 1].sID = temp.sID;
                   pass++;
              outputSID = String.valueOf(module[module.length].sID);
              outputMark = String.valueOf(module[module.length].mark);
              return (outputSID + " " + outputMark);
         public static String findLowest(StudentRecord module[], int numOfStudents)
              String outputMark;
              String outputSID;
              int j;
              StudentRecord temp = new StudentRecord();
              boolean intChange = true;
              int pass = 1;
              while((pass <= numOfStudents - 1) && (intChange))
                   intChange = false;
                   for (j = 1; j <= numOfStudents - pass; j++)
                        module[j] = new StudentRecord();
                        if(module[j].mark > module[j + 1].mark)
                             intChange = true;
                             temp.mark = module[j].mark;
                             temp.sID = module[j].sID;
                             module[j] = module[j + 1];
                             module[j + 1].mark = temp.mark;
                             module[j + 1].sID = temp.sID;
                   pass++;
              outputSID = String.valueOf(module[1].sID);
              outputMark = String.valueOf(module[1].mark);
              return (outputSID + " " + outputMark);
         public static String findGrade(StudentRecord module[], int numOfStudents, long studentID)
              String foundGrade = "";
              int i;
              String outputSID;
              String outputMark;
              for (i = 1; i <= module.length; i++)
                   module[ i] = new StudentRecord();
                   if (studentID == module[ i].sID)
                        outputSID = String.valueOf(module[ i].sID);
                        outputMark = String.valueOf(module[ i].mark);
                        foundGrade = (outputSID + " " + outputMark);
              if (foundGrade == "")
                   JOptionPane.showMessageDialog(null,
                        "No grade found for Student: " + studentID);
              return foundGrade;
         public static void studentIDSort(StudentRecord module[], int numOfStudents)
              int i;
              int j;
              StudentRecord temp = new StudentRecord();
              for (i = (module.length - 1); i >= 0; i--)
                   for (j = 1; j <= i; j++)
                        module[j] = new StudentRecord();
                        if (module[j - 1].sID > module[j].sID)
                             temp = module[j - 1];
                             module[j - 1] = module[j];
                             module[j] = temp;
         public static void markSort(StudentRecord module[], int numOfStudents)
              int i;
              int j;
              StudentRecord temp = new StudentRecord();
              for (i = (module.length - 1); i >= 0; i--)
                   for (j = 1; j <= i; j++)
                        module[j] = new StudentRecord();
                        if (module[j - 1].mark > module[j].mark)
                             temp = module[j - 1];
                             module[j - 1] = module[j];
                             module[j] = temp;
         public static void displayData(StudentRecord module[], int numOfStudents)
              String outputMessage = "";
              int i;
              for (i = 1; i <= module.length; i++)
                   module[ i] = new StudentRecord();
                   outputMessage += (module[ i].sID + " " + module[ i].mark + "\n");
              JOptionPane.showMessageDialog(null,
                   "Data Display\n" +
                   "**** *******\n\n" +
                   outputMessage,
                   "Data Display", JOptionPane.INFORMATION_MESSAGE);
    }

    Try this piece of code...... I adapted it to your program, so it starts from 1. You should pass numOfStudents - 1 as numOfStudents to don't get the notorious error =D
    if (menuChoice.equals("1"))
    findHighest(module, numOfStudents - 1);
    I added the println statement because in your prog isn't present an output routine (well, at last I didn't see it..... maybe because I'm sleepy =) )
    public static void findHighest(StudentRecord module[], int numOfStudents)
    String outputMark;
    String outputSID;
    StudentRecord retValue = new StudentRecord();
    retValue.sID = module[1].sID;
    retValue.mark = module[1].mark;
    for (int i = 2; i <= numOfStudents; i++) {
         if (module.mark > retValue.mark) {
         retValue.sID = module[i].sID;
         retValue.mark = module[i].mark;
    outputSID = String.valueOf(retValue.sID);
    outputMark = String.valueOf(retValue.mark);
    System.out.println(outputSID + " " + outputMark);
    Hope it can help you

Maybe you are looking for