Ending Loop

I have a mortgage calculator that dispalys the monthly payment, principle and interest paid, and principle remaining. The program works great, but doesn't stop at 360 months like is should. Below is the code. How do I get the program to end after 360 months?
Thanks!
import java.text.NumberFormat;
import java.util.Locale;
class Mortgage_Calc
public static void main(String[]arguments)throws Exception{
     //Allows For Currency Format
     NumberFormat formatter = NumberFormat.getCurrencyInstance(Locale.US);
     // Define the variables
     char ans = 'Y';
     double prin;
     double apr;
     double mo_Payments;
     double monthly_Interest;
     double monthlyInterestPaid;
     double monthly_principle;
     // Standard Integers
     int months; // Set months for later calculations
     int term = 30; // Number of Years
     int yearCnt = 1; // Counter for Years to increment in 12 Months (While Loop)
     int yearpluscnt; // Counter for Years (For Loop)
     int mthPaymentNum = 1; // Counter used later
     int max_Months; // Maximum Months
     //hard coded values
     prin = 200000; // Principle Value of the Mortgage
     apr = .0575; // Annual Percentage Rate
     // Calculate Values
     monthly_Interest = (apr / 12); // Monthly Interest Percentage
     months = (term * 12); // Total Amount of Months in the Term
     max_Months = months;
     monthlyInterestPaid =(prin * monthly_Interest); //monthly interst paid
     //Equation to calculate monthly payment
     mo_Payments = (prin * monthly_Interest) / (1-Math.pow(1 + monthly_Interest,- months));
     //monthly payment on the principle calculation
     monthly_principle = (mo_Payments - monthlyInterestPaid); //monthly principle
     // print Payment Summary
     System.out.println("\n\n\t Loan Summary\n");
     System.out.println("\n\n\t The amount of the mortgage is " + formatter.format(prin));
     System.out.println("\t With an annual interest rate of " apr * 100"%");
     System.out.println("\t your monthly payments will be " formatter.format(mo_Payments) " per month");
     System.out.println("\t for a term of "+term+ " years.\n\n");
     System.out.println("\n\t Here is the amortization schedule:");
     //Pause 3 seconds before displaying amortization schedule
     try
     Thread.sleep(3000);
     catch (InterruptedException e) {}
          // Do While Loop
          while(ans=='Y' || ans=='y'){
          // Print Headings
          System.out.println("\t--------------------------------------------------------------");
          System.out.println("\n\t Month \t Priciple Left \t Principle Paid \t Interest Paid\n");
          System.out.println("\t--------------------------------------------------------------");
               // For Loop To print Each Months Numbers
               yearpluscnt=mthPaymentNum+12;
               for (mthPaymentNum = yearCnt; mthPaymentNum < yearpluscnt ; mthPaymentNum++ ){
               //The new principle balance after subtracing from the remainder principle balance
               prin = (prin - monthly_principle);
               months = (months - 1);
               //monthly interest paid calculation
               monthlyInterestPaid = (prin * monthly_Interest);
               //monthly payment on the principle calculation
               monthly_principle = (mo_Payments - monthlyInterestPaid);
                    //Pausing before showing output for 2 seconds
                    try
                    Thread.sleep(50);
               catch (InterruptedException e) {}
               // Output Monthly Payment Information
               System.out.println("\t" + mthPaymentNum + "\t" +
               formatter.format(prin) + "\t" + formatter.format(monthly_principle) +
               "\t\t\t" + formatter.format(monthlyInterestPaid));
          System.out.print("\n\n\tWould you like to Continue? Y or N:");
          ans=(char)System.in.read();
          System.in.read();
          System.in.read();
          yearCnt = yearCnt+12;
          System.out.println("\n");
}

Sorry, I am new to this forum - I don't know the rules yet.
To be more specific, I want my program to stop calculating after 30 years or 360 months.
What do I need to add to make this happen?
import java.text.NumberFormat;
import java.util.Locale;
class Mortgage_Calc
public static void main(String[]args)throws Exception{
     //Defines currency format
     NumberFormat formatter = NumberFormat.getCurrencyInstance(Locale.US);
     // Define the variables
     char ans = 'Y';
     double apr;
     double monthly_Interest;
     double monthlyInterestPaid;
     double monthly_Payments;
     double monthly_principle;
     double principle;
     // Standard Integers
     int months; // Set months for later calculations
     int term = 30; // Number of Years
     int yearCnt = 1; // Counter for Years to increment in 12 Months (While Loop)
     int yearpluscnt; // Counter for Years (For Loop)
     int mthPaymentNum = 1; // Counter used later
     int max_Months; // Maximum Months
     //hard coded values
     principle = 200000; // Principle Value of the Mortgage
     apr = .0575; // Annual Percentage Rate
     // Calculate Values
     monthly_Interest = (apr / 12); // Monthly interest rate
     months = (term * 12); // Total number of months in the term
     max_Months = months;
     monthlyInterestPaid =(principle * monthly_Interest); //Monthly interst paid
     //calculation for monthly payment
     monthly_Payments = (principle * monthly_Interest) / (1-Math.pow(1 + monthly_Interest,- months));
     //calculation for monthly principle paid
     monthly_principle = (monthly_Payments - monthlyInterestPaid); //monthly principle
     // print payment summary
     System.out.println("\n\n\t Loan Summary\n");
     System.out.println("\n\n\t The amount of the mortgage is " + formatter.format(principle));
     System.out.println("\t With an annual interest rate of " +apr * 100+"%");
     System.out.println("\t your monthly payment will be " +formatter.format(monthly_Payments)+ " per month");
     System.out.println("\t for a term of "+term+ " years.\n\n");
     System.out.println("\n\t Here is the amortization schedule:");
     //3 second pause before displaying amortization schedule
     try
     Thread.sleep(3000);
     catch (InterruptedException e) {}
          //loop
          while(ans=='Y' || ans=='y'){
          // print headings
          System.out.println("\t-------------------------------------------------------------------");
          System.out.println("\n\tMonth\tInterest Paid \tPrinciple Paid \tPrinciple Balance\n");
          System.out.println("\t-------------------------------------------------------------------");
               // for loop to print each months numbers
               yearpluscnt=mthPaymentNum+12;
               for (mthPaymentNum = yearCnt; mthPaymentNum < yearpluscnt ; mthPaymentNum++ ){
               //The new principle balance after subtracing from the remainder principle balance
               principle = (principle - monthly_principle);
               months = (months - 1);
               //monthly interest paid calculation
               monthlyInterestPaid = (principle * monthly_Interest);
               //monthly payment on the principle calculation
               monthly_principle = (monthly_Payments - monthlyInterestPaid);
                    //Pause between monthly display
                    try
                    Thread.sleep(50);
               catch (InterruptedException e) {}
               // Print monthly payment information
               System.out.println("\t" + mthPaymentNum + "\t" +
               formatter.format(monthlyInterestPaid) + "\t\t" + formatter.format(monthly_principle) +
               "\t\t\t" + formatter.format(principle));
          System.out.print("\n\n\tWould you like to Continue? Y or N:");
          ans=(char)System.in.read();
          System.in.read();
          System.in.read();
          yearCnt = yearCnt+12;
          System.out.println("\n");
}

Similar Messages

  • End Loop when value is not in Table

    My tables:
    Possible_Ids
    2222
    1111
    3333
    4444
    Used_Ids
    5555
    6666
    2222
    7777
    Code so far:
    declare
    type array_type is table of Possible_ids%rowtype;
    id_array array_type;
    v_id char(4);
    v_counter number:=1;
    v_found number:=0;
    begin
    select * bulk collect into id_array from Possible_ids;
    loop
    if id_array(v_counter).co1 IN Used_ids table* then <--- I need help here,
    v_counter:= v_counter+1;
    else
    v_found:= 1;
    v_id:= id_array(v_counter).co1
    end if;
    exit when v_found = 1;
    end loop;
    dbms_output.put_line(v_id);
    end;
    Help: I need to somehow write a statement to instruct the code to "stop" when a value is NOT found in a table. From my tables, the first valid Possible_id would be '1111' since '2222' is already used.
    Edited by: Ludovick on Nov 2, 2010 10:25 AM
    Edited by: Ludovick on Nov 2, 2010 10:28 AM
    Edited by: Ludovick on Nov 2, 2010 10:29 AM

    Why so complicated. If you simply want to retrieve the lowest possible id that is not used you could do it like this.
    (I assume, your id column in both tables is named ID):
    declare
      v_id number;
    begin
      select min(id)
      into v_id
      from possible_ids
      where ID not in (select ID from used_ids);
      dbms_output.put_line('found id='||v_id);
    exception
      when no_data_found then
        dbms_output.put_line('no data found'); -- or whatever you want.
    end;If you don't need pl/sql you can do it with sql:
      select min(id)
      from possible_ids
      where ID not in (select ID from used_ids);

  • Problem in moving to next record in  For Loop end loop construct

    Hi friends i have the followind code in my stored proc. I am reading each row in the temprec and then based on the variable "i_copy_notes" processing the record. If the value of the I_copy_notes" varialble is 1 then i need to move to next record. when I am using "Next" then the compiler is telling me that the "NEXT" must be declared. Please advise.
    FOR TEMPREC IN
    SELECT
    DP_SER,
    GRD_POS,
    TS_POS,
    ASG_ID,
    DESCS,
    GRD_ID
    FROM DCGRD_POS
    WHERE CLLI = i_FROM_CLLI AND SUBSYS = i_SUBSYS AND BAY_ID = v_OLD_BAY_ID ORDER BY GRD_ID
    LOOP
    IF v_OLD_GRDID = TEMPREC.GRD_ID THEN
    v_NEW_GRDID := v_NEW_GRDID;
    IF i_COPY_NOTES = 1 THEN
    Next;
    END IF;
    ELSE
    v_OLD_GRDID := TEMPREC.GRD_ID;
    SELECT DCGRD_POS_GRD_ID.NextVal INTO v_NEW_GRDID FROM DUAL;
    END IF;
    INSERT INTO DCGRD_POS VALUES
    i_TO_CLLI,
    DCGRD_POS_ROW_SER.NextVal,
    TEMPREC.DP_SER,
    v_NEW_GRDID,
    v_NEW_BAY_ID,
    TEMPREC.GRD_POS,
    DECODE(i_COPY_NOTES,1, TEMPREC.TS_POS,''),
    TEMPREC.ASG_ID,
    DECODE(i_COPY_NOTES,1,TEMPREC.DESCS,'UASGN'),
    i_CURRENT_ISSUE,
    -1,
    i_SUBSYS,
    SYSDATE,
    i_USERID
    END LOOP;
    Line # = 315 Column # = 10 Error Text = PLS-00201: identifier 'NEXT' must be declared
    Line # = 315 Column # = 10 Error Text = PL/SQL: Statement ignored
    ----------------------------------------------

    Personally, I'm not a big fan of this technique but you can use a goto ...
    begin
    for i in 1.. 10 loop
       if i < 5 then
         goto end_of_loop;
       end if;
       dbms_output.put_line(i);
       <<end_of_loop>>
       null;
    end loop;
    end;

  • For j in (select a, (select 1 from dual),c ) loop ..end loop;...... error

    declare
    begin
    for cur in (select (select 1 from dual) col from dual)
    loop
      null;
    end loop;
    end;in TOAD, OK, BUT IN FORM ERROR!
    Edited by: indoracle on Feb 23, 2012 2:38 AM
    Edited by: indoracle on Feb 23, 2012 2:40 AM

    A couple of things.
    First, please take a few minutes to review the following:
    <ul>
    <li>Oracle Forums FAQ
    <li>Before posting on this forum please read
    <li>10 Commandments for the OTN Forums Member
    <li>How to ask questions the smart way
    </ul>
    Following these simple guidelines will ensure you have a positive experience in any forum; not just this one! ;-)
    Using the formating information in the Oracle Forms FAQ, it is always recommended that you put your code samples in the ... tags (use lower case "code") so your code is more readable.
    Second, the use of all capital letters is concidered YELLING. I'm sure you did not intend to YELL at anyone, so please only use capital letters when they are needed, not for everything. :)
    Third, what is your Forms Version? If you look at the *10 Commandments for the OTN Forums Member* you'll see that it is always best to give program version information. Depending on your Forms version, the subquery in your SQL statement may not be supported or it could simply be the Cursor For Loop construct [ FOR j IN ( SQL Statement)...] that is not supported. You may have to declare an explicit cursor and reference the explicit cursor in place of your SQL Statement.
    Forth, your FOR LOOP doesn't do anything!
    LOOPEND LOOP; There is nothing between LOOP and END LOOP. I am going to assume that this is intented and just a point of sanatizing your code because what happens in the loop is not relevant to the error.
    ERROR 103.. This is a Forms internal PL/SQL error; meaning the Forms PL/SQL engine can not parse your code. Again, this is probably because the subquery or cursor FOR loop with (SQL Statement versus explicit cursor) is not supported by your Forms version.
    Please, what is your Forms version and any other information that might be helpful.
    Craig...

  • Problem on I-TUNES,,,says my computer is not authorized to listen to a song I purchased....when I go to STORE/AUTHORIZE..it says my computer is already authorized....never-ending loop...won't play on IPOD either,,,HELP !

    Purchased a song on I-tunes....won't let me listen to it...says my computer is not authorized...first time in 3 years that this problem occured ...I went to STORE/AUTHORIZE ,,,and it says my computer is already authorized....never-ending loop ...HELP ! Won't play on Ipod either

    Delete and redownload it if doing so is free in your country.
    (88542)

  • AdamSync from AD to LDS goes into a continuous never ending loop... can't figure this out.

    I THINK I've got this thing configured up to the point where it should be able to sync.  The XML config is set to just grab a single OU with roughly 12 accounts in it.
    Everything seems to connect OK, then it does a ton of "Processing Entry", even though there are only a few accounts in this OU.
    Then it begins to do "Adding target object..." and gets stuck in a never ending loop.
    Can someone point me in the right direction on how to troubleshoot this?
    This is what the log looks like:
    ==========================
    Adamsync.exe v1.0 (6)
    Establishing connection to target server localhost:6389.
    There is already an active sync session in progress. 
    Please allow the session to complete, or use -mai to seize the role.
    Saving Configuration File on CN=Test,DC=domain,DC=org
    Saved configuration file.
    ADAMSync is querying for a writeable replica of 10.10.10.10.
    Error: DCLocator call failed with error 1355. Attempting to bind directly to string.
    Establishing connection to source server 10.10.10.10:389.
    Using file .\dam9280.tmp as a store for deferred dn-references.
    Populating the schema cache
    Populating the well known objects cache
    Starting synchronization run from dc=domain,dc=org.
    Starting DirSync Search with object mode security.
    Processing Entry: Page 1, Frame 1, Entry 0, Count 0, USN 0
    Processing source entry <guid=94f6d930da2339439df75278a02accae>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 1, Frame 1, Entry 1, Count 1, USN 0
    Processing source entry <guid=bf15bc4b684ece4f99010548e79decb0>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 1, Frame 1, Entry 2, Count 1, USN 0
    Processing source entry <guid=fcea01637658134eab7ec74fe022d4fe>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 1, Entry 35, Count 1, USN 0
    Processing source entry <guid=5e768f4392863b4d86935e6bf01acc25>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 1, Entry 36, Count 1, USN 0
    Processing source entry <guid=b5d263a264aad045b8f42f19b49dd844>
    Previous entry took 0 seconds (16, 0) to process
    Processing Entry: Page 3, Frame 1, Entry 37, Count 1, USN 0
    Processing source entry <guid=f19994051c804846b7bcbd066d9e9d40>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 1, Entry 38, Count 1, USN 0
    Processing source entry <guid=b16cd765bafa4f4d8649d91f0f055e5f>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 1, Entry 39, Count 1, USN 0
    Processing source entry <guid=6be6a7d551978445aafd3803e60dc560>
    Processing in-scope entry 6be6a7d551978445aafd3803e60dc560.
    Adding target object CN=User Name,OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org.
    Adding attributes: sourceobjectguid, instanceType, objectSid, sAMAccountName, lastagedchange, objectclass, 
    Adding target object CN=User Name,OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org. Requesting replication of parent.
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 2, Entry 0, Count 0, USN 53438354
    Processing source entry <guid=bbb4a760a8281741a11d9331efaa3d7a>
    Processing in-scope entry bbb4a760a8281741a11d9331efaa3d7a.
    Adding target object OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org.
    Adding attributes: objectClass, instanceType, sourceobjectguid, lastagedchange, 
    Adding target object OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org. Requesting replication of parent.
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 3, Entry 0, Count 0, USN 52660067
    Processing source entry <guid=8d3ef319dff31f47819632af2da5df2c>
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 2, Entry 0, Count 0, USN 53438354
    Processing source entry <guid=bbb4a760a8281741a11d9331efaa3d7a>
    Processing in-scope entry bbb4a760a8281741a11d9331efaa3d7a.
    Adding target object OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org.
    Adding attributes: objectClass, instanceType, sourceobjectguid, lastagedchange, 
    Adding target object OU=Staff Accounts,OU=Users,OU=ITS,CN=Test,dc=domain,dc=org. Requesting replication of parent.
    Previous entry took 0 seconds (0, 0) to process
    Processing Entry: Page 3, Frame 3, Entry 0, Count 0, USN 52660067
    Processing source entry <guid=8d3ef319dff31f47819632af2da5df2c>
    Previous entry took 0 seconds (0, 0) to process
    ===================================================

    Hi,
    Are there any error messages from the event log?
    Here is a KB article which describes a similar issue below I suggest you refer to:
    Error message when you use the Adamsync tool in Windows Server 2003: "Error: We seem to be in an infinite recursive loop"
    http://support2.microsoft.com/kb/926933
    Best Regards,
    Amy

  • A never ending loop...not sure why?

    When I run my current procedure, it seems to be getting caught in a never ending loop, not entirley sure what the problem is...? I'm not quite the expert so if possible, the more detail in the explaniation the better...thanks!!
    --The cursors
    cursor konami_mlb_pitchers_crsr is
       select player_id_1032
       from customer_data.cd_baseball_pit_ytd_stats
       where split_number = -3
         and game_type_id = 1
         and sequence = 0
         and season_id = iSeasonID
       order by player_id_1032;
    cursor konami_mlb_career_pit_crsr is
       select ytd.player_id_1032,
          ytd.player_id,
          ytd.moniker,
          ytd.last_name,
          sum(ytd.games_played),
          trunc(sum(ytd.outs_pitched) / 3) || '.' || mod(sum(ytd.outs_pitched), 3) as innings_pitched,
          sum(ytd.complete_games),
          sum(ytd.shut_outs),
          sum(ytd.wins),
          sum(ytd.losses),
          to_char((sum(ytd.wins)) / decode(sum(ytd.wins) + sum(ytd.losses), 0, 1, null, 1, sum(ytd.wins) + sum(ytd.losses)), '0d000') as winning_pct,
          trim(to_char( (9 * sum(ytd.earned_runs)) / (sum(ytd.outs_pitched) / 3) , '990d00')) as era,
          sum(ytd.strikeouts),
          sum(ytd.saves),
          sum(ytd.hits),
          sum(ytd.home_runs),
          sum(ytd.walks),
          sum(ytd.hit_batters),
          sum(ytd.earned_runs),
          sum(ytd.runs)
       from customer_data.cd_baseball_pit_ytd_stats ytd,  customer_data.cd_baseball_roster rost
       where ytd.split_number = -3
         and ytd.game_type_id = 1
         and ytd.sequence = 0
         and rost.player_id = ytd.player_id
         and rost.league_id = iLeagueID
         and ytd.season_id <= iSeasonId   
         and ytd.active_record != 'R'
         and ytd.player_id_1032 in
        --Includes Players that were on the DL for the entire season                                          
          select player_id_1032
         from customer_data.cd_baseball_roster r
         where r.year_last = 2008
         and r.league_id = iLeagueID
         and r.player_id_1032 is not NULL
         group by ytd.player_id_1032,ytd.player_id, ytd.moniker,  ytd.last_name;   --Where the cursor gets opened
    open konami_mlb_pitchers_crsr;
       loop
          fetch konami_mlb_pitchers_crsr into pitcher;
          exit when konami_mlb_pitchers_crsr%notfound;
          open konami_mlb_career_pit_crsr;
          loop
             fetch konami_mlb_career_pit_crsr into pitcher_record;
             exit when konami_mlb_career_pit_crsr%notfound;
             utl_file.put_line(file_handle, pitcher_record.first_name || ',' ||
                                            pitcher_record.last_name || ',' ||
                                            pitcher_record.id || ',' ||
                                            pitcher_record.games_played || ',' ||
                                            pitcher_record.innings_pitched || ',' ||
                                            pitcher_record.complete_games || ',' ||
                                            pitcher_record.shutouts || ',' ||
                                            pitcher_record.wins || ',' ||
                                            pitcher_record.losses || ',' ||
                                            pitcher_record.winning_pct || ',' ||
                                            pitcher_record.era || ',' ||
                                            pitcher_record.strikeouts || ',' ||
                                            pitcher_record.saves || ',' ||
                                            pitcher_record.hits || ',' ||
                                            pitcher_record.homeruns || ',' ||
                                            pitcher_record.walks || ',' ||
                                            pitcher_record.hit_batters || ',' ||
                                            pitcher_record.earned_runs || ',' ||
                                            pitcher_record.runs);
          end loop; -- end loop through the stats for each pitcher
          close konami_mlb_career_pit_crsr;
       end loop; -- end loop through all the pitchers
       close konami_mlb_pitchers_crsr;

    You don't seem to be using the cursor iterator variable "pitcher" when you print the data to the file. You are not even passing any parameter to the "konami_mlb_career_pit_crsr" cursor. As such the first cursor "konami_mlb_pitchers_crsr" appears to be redundant.
    Maybe the loop is time-consuming (instead of "never-ending"), and if you wait long enough, it will end. In the meantime, you may want to tune your logic.
    isotope

  • Wireless printer is setup, but the HP Installer Setup program is in a never-ending loop

    Wireless printer is setup (HP Officejet 4500), but the HP Installer Setup program is in a never-ending loop.  It says "Fatal error during installation." and keeps trying to uninstall/reinstall/ etc etc etc.  Printer is setup and runs fine, just need to get rid of this crazy loop - any guidance?
    Dee
    This question was solved.
    View Solution.

    Which OS is installed?
    I recommend that you uninstall the printer software from the HP folder in start-->All Programs -->HP --> uninstall software
    After the uninstall is completed and your system restarted install and configure the printer again.
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • Using a loop end loop

    I have the following code and it doens't like my loop statement.  it says it can be converted to line of  t_ord_data
    DATA: BEGIN OF TY_ORD_TYPE_DATA,
          SALES_ORDER LIKE /BIC/AZOS_O5900-DOC_NUMBER,
          SALES_ITEM LIKE /BIC/AZOS_O5900-S_ORD_ITEM,
          SCHED_LINE LIKE /BIC/AZOS_O5900-SCHED_LINE,
          SALE_DOC_TYPE LIKE /BIC/AZOS_O5900-DOC_TYPE,
          REF_DOC LIKE /BIC/AZOS_O5900-REFER_DOC,
          REF_ITEM LIKE /BIC/AZOS_O5900-REFER_ITM,
          REQ_DATE LIKE /BIC/AZOS_O5900-REQ_DATE,
          ZRELSDQTY LIKE /BIC/AZOS_O5900-/BIC/ZRELSDQTY,
          ZSHIPQTY LIKE /BIC/AZOS_O5900-/BIC/ZSHIPQTY,
          ZAVAILQTY LIKE /BIC/AZOS_O5900-/BIC/ZAVAILQTY,
          ZTLTVALUE LIKE /BIC/AZOS_O5900-/BIC/ZTLTVALUE,
          ZSHIPNOS LIKE /BIC/AZOS_O5900-/BIC/ZSHIPNOS,
          END OF TY_ORD_TYPE_DATA.
    DATA: T_ORD_DATA LIKE STANDARD TABLE OF TY_ORD_TYPE_DATA,
    LS_DATA like line of T_ORD_DATA.
    DATA: T_ZTAM_DATA LIKE STANDARD TABLE OF TY_ORD_TYPE_DATA,
    LS_ZTAM_DATA like line of T_ZTAM_DATA .
    LOOP AT T_ORD_DATA INTO T_ZTAM_DATA.
    DELETE T_ORD_DATA WHERE DOC_TYPE NE 'ZLZM'.
    END LOOP.

    Hi Immich,
    If you want to delete the records from the internal table TY_ORD_TYPE_DATA which does not have doctype zzlm, then you dont need to use the loop statement.
    You can directly write the code as,
    DELETE TY_ORD_TYPE_DATA where doctype NE zzlm.
    If you want to move the records (which doesnot have doctype zzlm) from TY_ORD_TYPE_DATA into T_ZTAM_DATA, then you need to write the code like below,
    <b>TYPES</b>: BEGIN OF TY_ORD_TYPE_DATA,
    " fields declared here
    END OF TY_ORD_TYPE_DATA.
    DATA: T_ORD_DATA <b>TYPE STANDARD TABLE OF</b> TY_ORD_TYPE_DATA,
               LS_DATA <b>TYPE TY_ORD_TYPE_DATA</b>.
    DATA: T_ZTAM_DATA <b>TYPE STANDARD TABLE OF</b> TY_ORD_TYPE_DATA,
               LS_ZTAM_DATA <b>TYPE TY_ORD_TYPE_DATA</b> .
    LOOP at TY_ORD_TYPE_DATA into LS_DATA WHERE doctyp NE zzlm.
    LS_ZTAM_DATA = LS_DATA.
    APPEND LS_ZTAM_DATA to T_ZTAM_DATA.
    ENDLOOP.
    <i><b>Reward points for helpful answers.</b></i>
    Best Regards,
    Ram.

  • End loop then advance to next frame

    I'm building a presentation and I'd like it if I could set up the following:
    There's a looping animation. It starts and ends with a solid transition to something else. However, I'm building this for a separate presenter (seveal, in fact) and I don't want to have to teach the timing over and over again. Plus I want this to be more consistant then the hope and pray method.
    What I want to happen:
    The presenter clicks the remote. The animation plays to the end of it's loop, then the slide transitions to the next slide. Advice?
    Info:
    Looping a Pro Res 422 file.
    All-Mac workflow
    OSX 10.8.4
    Keynote '09, Version 5.3

    if you are creating the loop animation within Keynote:
    create a new Keynote file
    add the images you want to animate
    Inspector > Build: select a build effect then more options, select start build: to automatically after prior
    create the QuickTime file:   Keynote > Share > QuickTime and set it to loop
    create a new presentation
    place the QuickTime file on slide 1
    Inspector > Transition > select a transition effect and choose start transition on click
    create a new slide and add the content you want

  • Min/Max never-ending loop

    I am trying to stream data off a real time module and then perform some calculations on it. I am reading the data through a front panel on my PC. I want to find a way to measure the max and the min of each data stream. I constructed the attached VI to do that. Since the loop does not end, the data gets stuck in the loop and no more data is read from the real time module. I cannot end the loop because then the max/min calculations will end. I have thought about storing all of the information in an array and then using the array min/max VI to do my calculations, but this would be extremely inefficient because I need my model to run for hours on end. Is there a way to calculate minimums and maximums without a loop or storing everything in an array? Sorry for the newbie question.
    Attachments:
    max test.vi ‏27 KB

    You are close to your solution. You need to wrap you data acquisition code with something similar to this loop. The way it is now the data is only read in once, then as you note it is stuck in the array. Another thing is the initializing values. If you make both of them 0, and use the same type as the input data, they will immediately show the min and maxes. Additionally, you can make your comparisons G.T or L.T rather than G.E. or L.E. Another method, if you can't put the data acquisition in this loop would be to make it a "LabVIEW2 style global", consisting of three states, initialize, write, read. The vi is called, with the initialize method before the DAQ loop, the write is called right after your DAQ, and in another loop the read is called.
    Putnam Monroe
    Senior Engineer - North Shore Technology, Inc.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion
    Attachments:
    MinMax.vi ‏45 KB

  • Never ending loop prevents all access on Prime pla...

    Two or three weeks ago I signed up to Prime Places. I received the post card last week and tried to verify location. Upon signing in to the system it took me to a URL that is TOTALLY STUCK. I then tried to sign in on another browser and it went directly upon signin to the same looping URL.
    My concern is that since it only loops I can't access any services inside Here.com. As soon as I signed in on my other browser (with my username) the loop started. MY WHOLE username ONLY LOOPS to that url. I have no way of accessing anything on here.com.
    I tried callin switchboard and I was cut off since I don't have a name. I live in Finland.
    Can you please contact directly here support internally because I'm totally lost. I repeat, if I sign in it loops immediately on my username!
    What to do?
    Here's the url http://primeplaces.here.com/places/verify/246ud9y7-f562061138fa4d59945c6ee2fc13b108

    Hi,
    The scenario here is that we need to add a line item (component) in IW32. We have to make use of Workflow to ensure that the component is added. If there are errors in adding the line item the workflow should get executed again untill it has successfully added a component/s.
    For this reason we are triggering a BOR object method (configured as triggering event in the task of WF) from 1 of the BADIs and calling a BAPI to update the work order.
    The problem is that even when the component has been added successfully the workflow doesn't end and keep on creating several similar components.
    I have tried to use loop condition and set the container value of flag to 'X' using FM SAP_WAPI_WRITE_CONTAINER but still the workflow keeps on creating the components in the background.
    Would appreciate your help on getting this solved, since this is a very critical delivery and also my 1st object in WF.
    Thanks,
    Sugandh

  • Never ending loop

    Hi all,
    I want to stop a loop which is not stopping. Is there any system variables in workflow, by setting that we can stop the workflow.
    Or please give me any other solution to stop it programattically,.
    Regards,
    Rubin
    Edited by: Rubin Luke on Sep 8, 2010 8:14 PM

    Hi,
    The scenario here is that we need to add a line item (component) in IW32. We have to make use of Workflow to ensure that the component is added. If there are errors in adding the line item the workflow should get executed again untill it has successfully added a component/s.
    For this reason we are triggering a BOR object method (configured as triggering event in the task of WF) from 1 of the BADIs and calling a BAPI to update the work order.
    The problem is that even when the component has been added successfully the workflow doesn't end and keep on creating several similar components.
    I have tried to use loop condition and set the container value of flag to 'X' using FM SAP_WAPI_WRITE_CONTAINER but still the workflow keeps on creating the components in the background.
    Would appreciate your help on getting this solved, since this is a very critical delivery and also my 1st object in WF.
    Thanks,
    Sugandh

  • Never ending loop is driving me loopy!

    If I spend anymore time on this I'll end up in a straight jacket(and then I might be able to get a job with Sun !)
    O.K. - here's the plan - the first loop should execute, evaluate if the value 'max' mod each value in the array is equal to 0. If none of the values in the array fit the criteria the program should then reach the second loop and keep going until a value is found that divides into the mod value. The second loop should stop when it reaches the square root of mod.
    Simple eh? Well it should be if I hadn't produced the code. The first loop works fine on its own and either stops when it has found the required value or stops when it reaches 999. However when the code includes the second loop as seen below the first loop becomes an endless loop.
    It is too hot today for me to be wearing a straight jacket and so I offer duke dollars to those who take pity.
    public static boolean primetest(BigInteger mod){
    BigInteger max = mod;
    int sqr = (int) Math.ceil(Math.sqrt(max.doubleValue())); // See java.lang.Math class
    BigInteger s = new BigInteger(Integer.toString(sqr));
    BigInteger endofarray = new BigInteger ("999");
    BigInteger start;
    //First loop starts here
    for (start = BigInteger.ZERO; start.compareTo(endofarray) <= 0; start = start.add(BigInteger.ONE)){
    //evaluate if max mod the next value in the array = 0
    if(max.mod(allprime[start.intValue()]).equals(BigInteger.ZERO)){
    pvalue = allprime[start.intValue()];
    qvalue = max.divide(allprime[start.intValue()]);
    System.out.println("P found :"+ pvalue + "Q found" + qvalue);
    return false;
    //Start next loop if none of the numbers in the array did the trick
    for (BigInteger i = new BigInteger("7919"); i.compareTo(s) < 0; i = i.add(TWO)){
    if(primetest(i))
    if(i.mod(max).intValue()== 0){
    qvalue = i;
    pvalue = i.divide(max);
    System.out.println("P found :"+ pvalue + "Q found" + qvalue);
    return true;
    }

    i think the second loop should return something. and according to me
    it will be like,
                   //Start next loop if none of the numbers in the array did the trick
                   for (BigInteger i = new BigInteger("7919"); i.compareTo(s) < 0; i = i.add(TWO))
                        if(primetest(i))
                             if(i.mod(max).intValue()== 0)
                                  qvalue = i;
                                  pvalue = i.divide(max);
                                  System.out.println("P found :"+ pvalue + "Q found" + qvalue);
                                  return false;
    try this.

  • How to end loop when desired value is found.

    Hi I have a loop below and I want the loop to end when the desired value is found.
    <?php do { ?>
    <?php $allvotedid = $row_VotedUsers['VotedID'] ?>
    <?php } while ($row_VotedUsers = mysql_fetch_assoc($VotedUsers)); ?>
    I want this loop to end when $row_VotedUsers['VotedID'] equals the URL variable ID. So lets say pagename.php?ID=1, I want the loop to go until it finds a value equal to ID which is 1. And then I want it to assign that value to $allvotedid. And if finds no value equal to it then I want it to stop looping.
    Thanks for any help. I hope I made this clear.

    cwhazzoo wrote:
    Hi I have a loop below and I want the loop to end when the desired value is found.
    The following will do what you have asked for:
    <?php do { ?>
    <?php
    if (isset($_GET['ID']) && $_GET['ID'] == $row_VotedUsers['VotedID']) {
      $allvotedid = $row_VotedUsers['VotedID'];
      break;
    } ?>
    <?php } while ($row_VotedUsers = mysql_fetch_assoc($VotedUsers)); ?>
    However, it's a very inefficient way of doing it. If what you're interested in is whether the ID passed through the URL is in the VotedID column, just create a recordset using the URL parameter ID ($_GET['ID']) as the filter. Then check the value of $totalRows_VotedUsers. If it's 1, the user has voted. If it's 0, the user hasn't voted.

Maybe you are looking for