V119 - Part I
V119 - Part II
VERBatim - V119
VERBatim - V120
V119 - Part I
V119 - Part II
VERBatim - V121
Utility Diskette # 3 - Part I
Utility Diskette # 3 - Part I
QTIPS - Moving Objects the EASY way.
QTIPS - DOSTime
VERBatim - V11
@ATTACK - @Backgrnd.Time
@ATTACK - @Index.Time
QTIPS - Time-outs in Windows
RTP Series - RTP50
@ATTACK - @Messages
Advanced Revelation Initialisation Sequence (Overview) by Mike Pope
Caching in on the Frames Array - Mike Pope
VERBatim - V126
Esc.To.Exit
Uncommon Knowledge - WC_WST_CHAR%
How Indexes Are Updated
QTIPS - Unexpected/Unwanted Modification Of Record On Write
QTIPS - DOS File Names
DOS Interfacing (Part II)
VERBatim - V116
@ATTACK - @Pri.File
@ATTACK - @Rollout.File
File Variables
How Indexes Are Updated
Index Record Layouts
QTIPS - File Variable of File In SELECT Statement
QTIPS - Amending non-Attached Files
LINEAR HASH FILE STRUCTURES - Part 1
Index Flush
QTIPS - File Handle Structure
RTP Series - RTP42
RTP Series - RTP51
Reader's Clinic - AREV Runtime
@ATTACK - @PDisk.On
Advanced Revelation Initialisation Sequence (Overview) by Mike Pope
AREV Comes to Czechoslovakia Les Palenik, Cosmotron Systems
RTP Series - RTP9
DOS Interfacing (Part II)
DOS Interfacing (Part II)
Creating Your Own Background Processes
@ATTACK - @Last.Select.Process
Reader's Forum
QTIPS - Menu Item Pre-Processing
Redefining Keys
Referential Integrity
@ATTACK - @Edit.Keys
@ATTACK - @Environ.Keys
@ATTACK - @Int.Const
@ATTACK - @Move.Keys
@ATTACK - @Priority.Int
@ATTACK - @Macro.Keys
@ATTACK - @Macro.Mode
Playing with Scan Codes
Uncommon Knowledge - WC_Unkeys%
Uncommon Knowledge - WC_Except_Keys%
Uncommon Knowledge - WC_Soft_Keys%
QTIPS - Deleting Master Relationally Indexed Records
Version 3 Technical Highlights - Deleting Accounts
Version 3 Technical Highlights - Deleting Rows Programmatically
Version 3 Technical Highlights - Deleting Tables Programmatically
Version 3 TCL Subroutines - Deleting Rows
Version 3 TCL Subroutines - Deleting Accounts
Version 3 TCL Subroutines - Deleting Tables
Version 3 TCL Subroutines - Removing Lists
@ATTACK - @Modal
QTIPS - Menus Without an Action Bar
REVMEDIA Revisted
QTIPS - Testing For Boolean False
Merge Processor
VERBatim - V6
QTIPS - /MERGE/
QTIPS - Merge Shortcuts
QTIPS - FOR/NEXT variables
VERBatim - V77
Batch.Indexing
QTIPS - Batch.Indexing Close Down
What's New (and un(der)documented!) In 2.12
DOS Interfacing (Part II)
Reader's Clinic - Preventing Records Being Amended
How Indexes Are Updated
A RevTechie Replies - And Miscellaneous Jottings - Mike Pope - Revelation Technologies (UK) Ltd
Caching in on the Frames Array - Mike Pope
What's New (and un(der)documented!) In 2.12
Utility Diskette # 4

RevMedia FKB

DocumentV1I8A3
TitleV119 - Part II
KeywordsV119
SORT
TextHaving considered how to use V119 to sort VARIABLES that can be held in memory we can now move on to sorting more records than can be held in memory at one time When sorting more records that will fit into memory the system cannot rely on a straightforward insertion or bubble sort Rather it must be
able to sort chunks of the data write out the sorted chunks to a file and
then sort this set of sorted chunks.

The way in which AREV sorts large amounts of data is to firstly open a sort
file then sort a block of data It then appends this sorted block of data to
the opened sort file It continues looping in this way retrieving a block
sorting appending until all records are processed It then merges all of
the chunks into one doubling the sort file size as the sorted data is put
at the beginning and the older information is put into the scratch area
above When this process has been completed ("Finalising Sort") it then goes
into another LOOP reading the sorting keys in blocks until they are all
gone Finally it deletes the sort file.

So to accommodate this V119 must be able to be called to open a file sort
records write records sort the file get the sorted ids and delete the
file Naturally it can do these things! To recap V119 is called WITH six
parameters viz CALL V119( ACTION FILE ORDER JUST DATA FLAG) To
accomplish all of the above the following CALLS are made

Initialise (Open the sort file)
ACTION = "I"
FILE = sort file name including path specification
ORDER
JUST
DATA null
FLAG = Returns true for OK false for file open failure

Sort (Sort the data)
ACTION = "S"
FILE = ""
Rest as documented in Issue 7

Write (Append the data to the sort file)
ACTION = "W"
FILE = sort file name including path specification
ORDER
JUST
DATA null
DATA consists of results of previous Sort action


FLAG = Returns true for OK false for write failure

Merge (Combine and sort the sort file)
ACTION = "M"
FILE = sort file name including path specification
ORDER
JUST
DATA null
FLAG = Returns true for OK false for merge failure

LOOP (Returns the next batch of sorted keys)
ACTION = "L"
FILE = sort file name including path specification
ORDER
JUST null
DATA = Key list
FLAG = Returns true for OK false for read failure

Delete (Remove the sort file)
ACTION = "D"
FILE = sort file name including path specification
ORDER
JUST
DATA null
FLAG = Returns true for OK false for delete failure


Representing the above explanation as pseudocode we would have

CALL V119("I") ; * Initialise
LOOP
UNTIL RECORDS EXHAUSTED
BUILD CHUNK
CALL V119("S") ; * Sort
CALL V119("W") ; * Append
REPEAT
CALL V119("M") ; * Merge
LOOP
UNTIL RECORDS EXHAUSTED
CALL V119("L") ; * Get IDS PROCESS IDS
REPEAT
CALL V119("D") ; * Delete file


(Volume 1 Issue 8 Pages 4 9)

[revmedia/copyrigh.htm]

Page last modified: 05/01/04