Code examples
Short programs that show how to do common jobs in Thoroughbred Basic, Dictionary-IV, Report-IV and Script-IV.
Thoroughbred Basic
- Rebuild auto-expanding Sort and Direct files
Thoroughbred Basic utility that builds a file list with *BPSD, then rebuilds every auto-expanding Sort and Direct file in the list through a temporary copy.
- Convert date type 7 to a number
Thoroughbred Basic example that decodes a type 7 date, stored in three bytes, into a YYMMDD string and converts it to a number with DTN.
- Send commands to a modem and read the reply
Thoroughbred Basic example that opens a modem as a device, dials with AT commands and prints each reply until the modem stops responding.
- Get a UNIX file's permissions with XFD
Thoroughbred Basic example that reads a file's mode from XFD and shows it in UNIX rwx form next to the output of ls -l.
- Save a program as an INDEXED file with a ghost task
Thoroughbred Basic example that starts a ghost task, loads a program into it and LISTs the program into an INDEXED file.
- Get the key length of a format
Thoroughbred Basic example that includes a format and adds up the lengths of its key data names with ATR to get the key length.
- Count the used records in an MSORT file
Thoroughbred Basic example that reads an MSORT file's header and deleted-key blocks to work out how many records are in use.
Dictionary-IV and OPENworkshop
- List the report selections on a menu
Thoroughbred Basic utility that reads a menu definition from IDDBD and prints the name of every selection on it that runs a report.
- Call CONNECT MENU from Basic (OO1Z)
Thoroughbred Basic example that sets the IDOL-IV system variables and calls OO1Z, the CONNECT MENU method, to display a Dictionary-IV menu.
- Call CONNECT SCREEN from Basic (OO2A)
Thoroughbred Basic example that calls OO2A to run CONNECT SCREEN with a screen and view from the UT sample library.
- Call CONNECT VIEW from Basic (OO3A)
Thoroughbred Basic example that calls OO3A to run CONNECT VIEW on the UT sample customer view, with sort, cursor and change options set.
- Display a text field from Basic with 8TEXTF
Thoroughbred Basic example that steps through a data file and shows each record and its text field in a window by calling 8OPENS, 8PRINT and 8TEXTF.
- Remove, copy and restore Dictionary-IV printer tables
Three Thoroughbred Basic programs that remove a printer table from IDDBD, copy a printer table to a file, and load a copied table back into IDDBD.
- Run the TAPVITLD method from cron
Thoroughbred Basic program and script that run the TAPVITLD method unattended, for example from a UNIX cron job using an IPL file with a null device.
- Copy window and color settings between operators
Thoroughbred Basic utility that copies one operator code's window and color settings to every operator record in IDDBD.
Report-IV
- Force Report-IV to rephase all reports
Thoroughbred Basic program that clears the R2 and R3 records Report-IV keeps in IDDBD, so every report is rephased the next time it runs.
- Call CONNECT REPORT from Basic (OOR)
Thoroughbred Basic example that calls OOR to run a Report-IV report from the UT sample library, then runs the program ID.
- Print a report to a file in another directory
Script-IV example that runs CONNECT REPORT with output to a file in directory 1, and the change to OOU3 that stops the report going to directory 0.
- Send data from a script to a report with FORMAT INCLUDE
Report-IV definition and Script-IV source that pass a customer code entered on a screen to a report through FORMAT INCLUDE.
Script-IV
- Convert date type 6 to a number
Script-IV example that reads a type 6 date from a link, builds a YYYYMMDD string from it and converts that to a number with DTN, then back to a date with NTD.
- Scroll a multi-line screen with LINE OFFSET
Script-IV example that enters several records on one screen with LINE OFFSET, scrolling with the arrow and page keys through a five-line window.
- Run CONNECT VIEW commands with VIEW$[7] and VIEW$[16]
Script-IV examples that use VIEW$[7] for SELECT WHEN, SORT and USING clauses and VIEW$[16] for view commands such as COUNT, LIST, COPY and CHANGE.
- Update field data in a pre-process and redisplay it
Script-IV pre-process script (type P) that changes a field value in the record before input, so the new value is redisplayed in the view.
- Read, edit and write a text field with OO41 and OO5
Script-IV example for 8.4.1 and later that reads a text field with OO41, edits it in the OO5 text editor window and writes it back.
- Read and write text fields, Source-IV and help with OO41
Script-IV example that uses OO41 to write and read a format text field, read a Source-IV document and read an IDOL-IV help document.
Windows
- Display an image and text with GWW IMAGE
Thoroughbred Basic example that calls GWWCOM so Gateway for Windows shows a picture with a button and two captioned text boxes.
Looking for something else? Ask on the mail-list or search the manuals.