SlideShare une entreprise Scribd logo
1  sur  11
Algorithm #2

    CHANGE transaction;
Several transactions per master
             record
Assumptions
• Let the sentinel value be equal to 999
• Let there be a function Get_Next_Master defined as
  follows:
       if eof(master)
          master_key = sentinel
          else input next master record
• Let there be a function Get_Next_Trans defined as
  follows:
       if eof(trans)
           trans_key = sentinel
           else input next trans record

                     Prepared by Perla P. Cosme        2
Recall Algorithm #1
Get_Next_Master
Get_Next_Trans
While NOT (master_key==sentinel AND trans_key==sentinel)
  if (master_key < trans_key)
      { output master record to new master file
          Get_Next_master
       }
       else if (master_key == trans_key)
                { make a change in the master record
                    output master record to new master file
                    Get_Next_Trans
                    Get_Next_Master
                  }
             else
                 { print “no matching record in the master file”
                    Get_Next_Trans
                  }
                             Prepared by Perla P. Cosme                         3
We shall delete this line
Get_Next_Master
Get_Next_Trans
While NOT (master_key==sentinel AND trans_key==sentinel)
  if (master_key < trans_key)
      { output master record to new master file
          Get_Next_master
       }
       else if (master_key == trans_key)
                { make a change in the master record
                    output master record to new master file
                    Get_Next_Trans
                    Get_Next_Master
                  }
             else
                 { print “no matching record in the master file”
                    Get_Next_Trans
                  }
                             Prepared by Perla P. Cosme                          4
Get_Next_Master                                            After making the
Get_Next_Trans                                          CHANGE, we suspend
                                                     temporarily the writing of
While NOT (master_key==sentinel AND trans_key==sentinel) to the new
                                                        the record
  if (master_key < trans_key)                          master file until we can
      { output master record to new master file        prove that there are no
          Get_Next_master                                    more CHANGE
                                                      transaction for that same
       }                                                        record.
       else if (master_key == trans_key)
                { make a change in the master record
                    output master record to new master file
                    Get_Next_Trans
                    Get_Next_Master                     …… and we suspend too,
                  }                                      taking another master
             else                                         record because of the
                                                         possibility that the next
                 { print “no matching record in the master file”
                                                           transaction might be
                    Get_Next_Trans                        referencing the same
                  }                                           master record


                               Prepared by Perla P. Cosme                     5
Let’s simulate the SFO using
            Algorithm #2

We shall use the same example as what we
 presented previously.




                 Prepared by Perla P. Cosme   6
The Second Algorithm
CHANGE transaction; several transactions per record




      MF       3              6                 10   11


      TF 3            3           11            11   11
         C            C           C             C    C


                   Prepared by Perla P. Cosme             7
Analysis
There are three (3) possible cases that we can
  identify when comparing the master key and
  the transaction key:
2.Master key < transaction key
3.Master key = transaction key
4.Master key > transaction key



                  Prepared by Perla P. Cosme     8
There is no transaction

                  Analysis
                                                for the master record,
                                                 hence, it will just be
                                               copied or written to the
                                                   new master file.

There are three (3) possible case that we can
  identify when comparing the master key and
  the transaction key:
2.Master key < transaction key
3.Master key = transaction key
4.Master key > transaction key



                  Prepared by Perla P. Cosme                              9
When master key is equal

                    Analysis
                                                   to transaction key, that
                                                    means that the record
                                                 exists, and hence, we can
                                                  implement the CHANGE
There are three (3) possible cases that we can           transaction.

   identify when comparing the master key and the
   transaction key:
2. Master key < transaction key
3. Master key = transaction key
4. Master key > transaction key

Note: Among the 3 cases above, it is only in case #2
 above where we are allowed to change. Why?

                    Prepared by Perla P. Cosme                                10
When this condition

                  Analysis
                                                holds true, that means
                                                 that the transaction is
                                                  invalid because you
                                               cannot change a record if
                                               the record does not exist
There are three (3) possible case that we can      in the master file.
  identify when comparing the master key and
  the transaction key:
2.Master key < transaction key
3.Master key = transaction key
4.Master key > transaction key



                  Prepared by Perla P. Cosme                               11

Contenu connexe

En vedette

Algorithm 3
Algorithm  3Algorithm  3
Algorithm 3gwsy93
 
Algorithm 1
Algorithm  1Algorithm  1
Algorithm 1gwsy93
 
Wave of Women Ambassadors campaign launch March 23, 2012
Wave of Women Ambassadors campaign launch March 23, 2012Wave of Women Ambassadors campaign launch March 23, 2012
Wave of Women Ambassadors campaign launch March 23, 2012Wave of Women Ambassadors
 
Why Do You Lead? What Are You Trying to Accomplish?
Why Do You Lead? What Are You Trying to Accomplish?Why Do You Lead? What Are You Trying to Accomplish?
Why Do You Lead? What Are You Trying to Accomplish?Charles Brewer
 
Inv pres q32016_final
Inv pres q32016_finalInv pres q32016_final
Inv pres q32016_finalCNOServices
 

En vedette (8)

Algorithm 3
Algorithm  3Algorithm  3
Algorithm 3
 
AICRC
AICRCAICRC
AICRC
 
Hiprevínculos
HiprevínculosHiprevínculos
Hiprevínculos
 
Algorithm 1
Algorithm  1Algorithm  1
Algorithm 1
 
AICRC
AICRCAICRC
AICRC
 
Wave of Women Ambassadors campaign launch March 23, 2012
Wave of Women Ambassadors campaign launch March 23, 2012Wave of Women Ambassadors campaign launch March 23, 2012
Wave of Women Ambassadors campaign launch March 23, 2012
 
Why Do You Lead? What Are You Trying to Accomplish?
Why Do You Lead? What Are You Trying to Accomplish?Why Do You Lead? What Are You Trying to Accomplish?
Why Do You Lead? What Are You Trying to Accomplish?
 
Inv pres q32016_final
Inv pres q32016_finalInv pres q32016_final
Inv pres q32016_final
 

Dernier

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 

Dernier (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 

Algorithm 2

  • 1. Algorithm #2 CHANGE transaction; Several transactions per master record
  • 2. Assumptions • Let the sentinel value be equal to 999 • Let there be a function Get_Next_Master defined as follows: if eof(master) master_key = sentinel else input next master record • Let there be a function Get_Next_Trans defined as follows: if eof(trans) trans_key = sentinel else input next trans record Prepared by Perla P. Cosme 2
  • 3. Recall Algorithm #1 Get_Next_Master Get_Next_Trans While NOT (master_key==sentinel AND trans_key==sentinel) if (master_key < trans_key) { output master record to new master file Get_Next_master } else if (master_key == trans_key) { make a change in the master record output master record to new master file Get_Next_Trans Get_Next_Master } else { print “no matching record in the master file” Get_Next_Trans } Prepared by Perla P. Cosme 3
  • 4. We shall delete this line Get_Next_Master Get_Next_Trans While NOT (master_key==sentinel AND trans_key==sentinel) if (master_key < trans_key) { output master record to new master file Get_Next_master } else if (master_key == trans_key) { make a change in the master record output master record to new master file Get_Next_Trans Get_Next_Master } else { print “no matching record in the master file” Get_Next_Trans } Prepared by Perla P. Cosme 4
  • 5. Get_Next_Master After making the Get_Next_Trans CHANGE, we suspend temporarily the writing of While NOT (master_key==sentinel AND trans_key==sentinel) to the new the record if (master_key < trans_key) master file until we can { output master record to new master file prove that there are no Get_Next_master more CHANGE transaction for that same } record. else if (master_key == trans_key) { make a change in the master record output master record to new master file Get_Next_Trans Get_Next_Master …… and we suspend too, } taking another master else record because of the possibility that the next { print “no matching record in the master file” transaction might be Get_Next_Trans referencing the same } master record Prepared by Perla P. Cosme 5
  • 6. Let’s simulate the SFO using Algorithm #2 We shall use the same example as what we presented previously. Prepared by Perla P. Cosme 6
  • 7. The Second Algorithm CHANGE transaction; several transactions per record MF 3 6 10 11 TF 3 3 11 11 11 C C C C C Prepared by Perla P. Cosme 7
  • 8. Analysis There are three (3) possible cases that we can identify when comparing the master key and the transaction key: 2.Master key < transaction key 3.Master key = transaction key 4.Master key > transaction key Prepared by Perla P. Cosme 8
  • 9. There is no transaction Analysis for the master record, hence, it will just be copied or written to the new master file. There are three (3) possible case that we can identify when comparing the master key and the transaction key: 2.Master key < transaction key 3.Master key = transaction key 4.Master key > transaction key Prepared by Perla P. Cosme 9
  • 10. When master key is equal Analysis to transaction key, that means that the record exists, and hence, we can implement the CHANGE There are three (3) possible cases that we can transaction. identify when comparing the master key and the transaction key: 2. Master key < transaction key 3. Master key = transaction key 4. Master key > transaction key Note: Among the 3 cases above, it is only in case #2 above where we are allowed to change. Why? Prepared by Perla P. Cosme 10
  • 11. When this condition Analysis holds true, that means that the transaction is invalid because you cannot change a record if the record does not exist There are three (3) possible case that we can in the master file. identify when comparing the master key and the transaction key: 2.Master key < transaction key 3.Master key = transaction key 4.Master key > transaction key Prepared by Perla P. Cosme 11