SD Core Solo for Windows WS2.0-0

SD TCL - The Development Tools: tool.bulk

A bulk update of one data file: a dry run first, then apply, and undo.

This page continues SD TCL - The Development Tools: tool.query.

tool.bulk - a bulk update of one data file#

tool.bulk

tool.bulk changes many records of one data file of your account in one go, and shows you what it will do before it does it. You choose the file, say which records, say what is to be done to them, look at a dry run, and only then apply it; if it was wrong, U puts the records back. It is a front end: it adds no access, and the checks of the system are the checks it meets.

The page has four boxes:

box what it holds
File the file chosen, and the Your gates line (always on in Solo)
Which records the way the records are chosen, and how many that selects now
What to do to them up to ten operations, in order
Result the dry run, the last run, the last run's undo, and before and after of the first twenty records that would change

The file#

F lists every file your VOC points at, with the reason beside each one this page will not update, and lets you type a name. The page updates dynamic data files only. It refuses, up front and by what the file is and by its name: a directory file, a sequential file, a file on another server, the VOC, a dictionary (a name ending .dic) and a program file (bp, bp.out, any .bp or .bp.out). A read-only file is refused. Choosing another file clears the selection and the operations.

Which records#

M chooses how: conditions, a saved list or every record. After every change the page counts what the choice selects.

One run takes at most 100000 records; a bigger selection is counted and refused. The page uses the session's default select list (list 0) for the count, so a list you had active is not kept.

What to do to them#

N adds an operation, E changes it, X takes it out. Each works on one attribute, given as a number from 1 to 999 or picked from the D items of the file's dictionary, and on the attribute as a whole:

operation does
set to a constant puts the text in the attribute
set to null empties the attribute
append text adds the text at the end
prepend text adds the text at the start
replace text replaces every occurrence of one text with another (an empty second text takes it out)
add a number adds a number (a negative one takes away); the attribute must hold a number, and the sum is kept to 4 decimals, so a number or an amount with more decimals (or more than 15 characters) leaves the record alone
upper case, lower case changes the case of the letters
copy from another attribute puts another attribute's value in this one

Text is printable ASCII, at most 120 characters. There are no expressions. An operation that changes nothing writes nothing (an attribute past the end of the record is not padded for nothing); two values that look like numbers are compared as text, so putting 007 over 7 is a change. A record where add a number meets an empty attribute, text or too many decimals is not touched at all: the dry run counts it as one it cannot work out and apply leaves it alone.

The dry run#

R makes the dry run, and it writes nothing. It reads every selected record, works out the new one and tells you how many were selected, would change, would stay as they are, cannot be worked out and were not found, with before and after of the first twenty that would change (the page moves to the Result box; Up and Down read the list). A is on the function-key row only while a dry run of exactly the settings on the screen stands; any edit of the file, the selection or an operation makes it stale.

Apply#

A shows a box with the operations in words and the number of records, and asks for the file's name, typed. Cancel is what Enter chooses. Then, for each record the dry run found would change:

  1. the record is read for update; one that another session holds locked is skipped and counted;
  2. if it is no longer exactly what the dry run read (someone changed it since, or it is gone), it is skipped and counted;
  3. the record as it is goes to &bulk.undo&, then the new record is written, then the lock is released;
  4. the first write error stops the run.

The Result box says how many were to change, changed, skipped because locked, skipped because they were not as the dry run read them, and errors. One line goes to the audit trail: bulk update file=<file> records=<n>, with no data. After a run the dry run is spent: R makes another.

Undo#

&bulk.undo& is a file of your own account, made the first time through a box that shows create.file &bulk.undo&. The page uses it only if it is a dynamic file with that name standing in your own account directory: a VOC name pointed at a program file, a dictionary or a file elsewhere is refused, and nothing is applied or put back. It holds the last run only (a new run replaces it): a header and, for each record changed, its id, a digest of what the run wrote and the record as it was. U puts the last run back, after a box that asks the file's name typed. A record is put back only if it is still exactly what the run wrote: one changed since, one gone, one another session has locked, is left alone and counted (a locked one can be put back by another U once it is free). Undo writes one audit line, like a run: bulk undo file=<file> records=<n>, with no data.

What the keys do#

key does
F6, Shift-F6 changes the list (Selection, Operations, Result)
F choose the file
M, L, J how the records are chosen, a saved list, all or any (Selection)
N, E, X add, change, remove a condition or an operation
R dry run
A apply (only after a dry run of these settings)
U undo the last run
F5 read the file, the count and the undo file again
F1, ?, a click on [?] help
Ctrl-Q leave

No added access. Nothing is added to what your session may do. The VOC, a dictionary and a program file are refused here by what they are, whatever the session may do elsewhere.

Continued in#

SD TCL - The Development Tools: tool.catalog and tool.test — tool.catalog and tool.test.