Difference between revisions of "Personal record keeping"

From Ninerpedia
Jump to navigation Jump to search
(define call h)
(→‎Input of data by user CALL A: add reference to different 99/4 keyboard mapping)
Line 47: Line 47:
  these values is rejected.
  these values is rejected.
        
        
NB: The CLEAR key is used to clear the input field. It WILL NOT break into the program! Use CALL A with a little care if you think you may need to BREAK the program!  
NB: The CLEAR key is used to clear the input field. It WILL NOT break into the program! Use CALL A with a little care if you think you may need to BREAK the program!


For 99/4 keyboard mapping for the function keys see [[TI99/4 and 4a differences]]


===Partition Memory CALL P===
===Partition Memory CALL P===

Revision as of 13:05, 9 November 2014

The Personal Record Keeping (PRK) module enables you to store up to about 10k of data, and provides various handling and output facilities to help you manipulate your records.

A printer is useful but not essential. If you have a printer, greater flexibility of display, as well as additional functions, are provided with the Personal Report Generator module, which requires data prepared with the Personal Record Keeping module.

The PRK sorting routines are slow.

Data is saved in memory image ('program') format, and thus uses less tape (or disk) space, is faster to save and load, and the verify option is available for tape files.

You will not be able to catalog a collection of six thousand records, but small collections can be catalogued with the module . The number of items depends on how many characters you wish to use to describe each item.

It is possible to use the PRK module as a simple diary system, or as a very simple spreadsheet, as it is possible to perform mathematical operations on the data you place in your module.

Enhanced Basic

The Personal Record Keeping and the Statistics modules both extend the range of commands available in TI BASIC. This was not publicised. The term Enhanced Basic was given by Peter Brooks who published a great deal on the extra CALLs.

These extra commands are the only way in which a user can save data in PROGRAM format - used by most TI Modules. Program format permits tape verification, and uses a lot less space on your tape or disk.

With either module inserted, select TI BASIC. You may now use the following commands:

Screen Display CALL D

CALL D(R,C,L,V)

Where R and C are the row and column the word is to start at.
L is the length of screen to be blanked from position
R,C and also sets the maximum length of the display
V is a value or string or variable to be displayed.

If V is longer than L, the display will be curtailed.
R,C and L may be numbers or numeric variables.

Try:
CALL D(10,4,5,1/3)        

Input of data by user CALL A

CALL A(R,C,L,F,A,MN,MX)

R,C and L are as with CALL D, but in CALL A, L sets the
maximum length of the input.
F   MUST   be a NUMERIC VARIABLE. It takes a value of 1 if
ENTER is pressed, and other values if some control keys are used
eg BEGIN:6  REDO:4  AID:3  BACK:7  CLEAR:2
A is the numeric or string VARIABLE to be filled with the
input.
MN and MX are optional when using a numeric variable, and set
the minimum and maximum acceptable values: any input outside
these values is rejected.
      

NB: The CLEAR key is used to clear the input field. It WILL NOT break into the program! Use CALL A with a little care if you think you may need to BREAK the program!

For 99/4 keyboard mapping for the function keys see TI99/4 and 4a differences

Partition Memory CALL P

CALL P(N) - Partition

This CALL is required if we wish to interact in Basic with a PRK data file loaded into memory. It is not required if you just want to use CALL A or CALL D.

We have to reserve memory to place the PRK data into - it was saved as a memory block and must be loaded as a memory block. Using CALL P splits the memory so that the PRK data can reside safely on its own, and the remainder of memory can be used as normal for our Basic program.

In order to prepare or partition the RAM memory space in two sections the statement CALL P(N) has to be entered in the immediate mode as a first action after the TI BASIC READY prompt from the computer and must be followed by NEW.

Here for convenience we shall use MEM1 (normal RAM) and MEM2 (PRK file memory).

CALL P(N) use as N a number (constant) (an integer between -4 and 13821) which points to the spot in the RAM stack where OLD will start loading a BASIC program instead of what otherwise would have been the starting address reserved for OLD.


The memory space below this point is the thus created MEM2 and consists of N bytes to be used for PRK data.

normal memory:          PARTITIONED MEMORY:
 +-------------+        +----------------+  
 |              |        |                  | 
 |     usual    |        |  MEM1 (basic)   | 
 |     RAM      |        |  16000-N         | 
 |              |        |   bytes          | 
 |    16000     |  -N-  |-----------------| 
 |    bytes     |        | MEM2 (prk data) |     
 |              |        |  N bytes        | 
 +-------------+        +----------------+ 

If you need a large MEM2 (e.g. because a large PRK file has to be loaded) then N must he in the higher range. This obviously at the same time restricts the size of MEM1 for your Basic program.

If on the other hand you have a large TI Basic program or need to load a lot of "normal" data, but still you want to interact with a PRK file as well, then you are best off with a large MEM1 and a small MEM2 when in the CALL P(N) statement you assign a low value to N.

MEM1 is cleared and loaded with programs and data in the usual way with NEW, OLD, SAVE, INPUT and PRINT without affecting MEM2 in any way. PRK data are loaded in MEM2 with the statement:

CALL L("CS1",C) 
(or CALL L("DSK1.FILE",C))

resulting in the usual cassette prompts which will now read data previously generated by the PRK module in its normal mode.

An error message: ERROR DETECTED IN DATA may mean that MEM2 is not large enough to contain the PRK data and a new CALL P(N) with a higher N must be entered (and followed by NEW). The quickest and surest way to remove the previous CALL P is to switch the console off and on again.

Save Memory Image CALL S

CALL S("CS1",C)

C is a control variable that gets a value 0 if loading or saving has been successful. When an error has been detected the value of C in not equal to 0.

Instead of "CS1" also "DSK1.FILE" or "RS232" may be used for similar interaction with these devices.

Load Memory Image CALL L

CALL L("CS1",C)

C is a control variable that gets a value 0 if loading or saving has been successful.

When an error has been detected the value of C in not equal to 0.

Instead of "CS1" also "DSK1.file" or "RS232" may be used for similar interaction with these devices.

Define Data Header CALL H

It is easiest to amend the data header with the module, but here is the technical data for you. To change a file structure the Personal Report Generator module may be easier.

CALL H affects the header, i.e. those choices that the PRK does not permit you to alter, once you have okayed the file structure.

Changing the names of FILES and ITEMS is a cinch.

Changing the type or width if ITEMS is also easy, but the results are usually not the ones aimed for, because all data are written sequentially.


The syntax and parameters of CALL H are:

 Read mode: CALL H(1,INFO,ITEM,VALUE) 
 Write mode: CALL H(0,INFO,ITEM,VALUE) 
INFO Stands for 
   1 File name (maximum of 9 characters) 
   2 Day of the month 
   3 Month 
   4 Year 
   5 * Number of items per page 
   6 * Number of pages 
   7 * Length of header in bytes 
   8 * Length of each page in bytes 
   9 Item name (maximum of 9 characters) 
  10 Type of item (1 = char; 2 = integers; 3 = decimals; 4 = scientific) 
  11 Width of item 
  12 Number of decimal places 
  13 * Amount of memory required for this item in bytes 
  14 * Position of item in page 
* = this value is automatically calculated and placed by PRK mode 

The ITEM value is of no importance for those INFO values between 0 and 9

Setting up the header (i.e. file structure) is easiest in the module mode (Let's begin- create a file), but if you insist on doing this from TI Basic start with INFO 9 to 12 before going on to INFO 1-4.

Data field handling CALL G

Getput - there are several formats depending upon what you wish to do with CALL G.

The CALL G ( G for getput) statement has a write mode and a read mode.

In the write mode it enables the user to change PRK data, which might also have been changed using the normal procedures of the PRK module (change a page and mathematical transformations). VALUE may be a numeric or a string variable.

Write mode: CALL G (0,PAGE,ITEM,VALUE)


Read mode: CALL G(1,PAGE,ITEM,MIS,VALUE) 

MIS in read mode is a control variable: if data found then MIS=0. When no data found MIS=1.

If a string variable is used for VALUE (e.g. VALUE$) and the ITEM type was chosen as "characters", then strings can be handled.

CALL G(2,PAGE,ITEM,VALUE) writes "nothing" (=missing data) in the assigned place. The value or VALUE has no meaning.

Transferring PRK data to a Display Variable disk file for TI Writer

This BASIC program requires a Personal Record Keeping module and a disk drive with disk controller.

Console set up:

Insert PRK module and then select TI BASIC (Stats module may also be used)
FIRST: Is disk drive connected? Set buffer location with CALL FILES(1) then NEW -
THEN: type CALL P(10900) then type NEW
Console memory is now set up

RESTRICTIONS:

The disk system and this program use up memory.

It may be necessary to delete some records from the PRK file to be transferred if the PRK file fully utilises system memory.


99 REM Load the PRK file
100 CALL L("DSK1.PRKFILE",Y)
102 REM is file loaded?
110 IF Y=0 THEN 320
111 REM NOW open output file
112 REM NB: do not open output file until after Call L !
120 OPEN #1:“DSK1.TIH_FILE“,DISPLAY,VARIABLE 80
121 REM How many fields in each record?
130 CALL H(1,5,0,F)
140 PRINT "FIELDS":F
141 REM How many records (pages)?
150 CALL H(1,6,0,R)
160 PRINT "RECORDS":R
161 REM Now loop: through each record:
170 FOR J=1 T0 R
171 REM and through each field in turn
180 FOR T=1 TO F
181 REM Is the field a number or a string?
190 CALL H(1,10,T,TP)
200 IF TP=1 THEN 240
201 REM for numeric data:
202 REM get the data in record J,. field T
210 CALL B(1,J,T,Z,RD)
211 REM and print it to disk
220 PRINT #1:RD 
230 GOTO 270
231 REM for string variable data:
240 CALL G(1,J,T,Z,RD$)
250 PRINT J;T;RD$
260 PRINT #1:RD$
270 NEXT T
271 REM insert spacing as required
280 PRINT #1:" "::: 
290 NEXT J
300 CLOSE #1
310 END
320 PRINT "NOT LOADED“

If required, string and numeric data can be concatenated to the preferred format before printing to disk. Read each required field, concatenate, and print.

Each print to disk should be considered as one TI Writer line:

Use of pending outputs is to be avoided, as is the use of a semi colon print divider, due to the complex requirements of DISPLAY format.