jlogdup


The jlogdup command provides the capability to duplicate log set data from the jBASE Transaction Journal. This command can be used to duplicate log data to or from any platform file, including device files, standard input, ‘stdin’, and standard output, ‘stdout’.

SYNTAX

jlogdup -Options INPUT input_spec OUTPUT output_spec

 

SYNTAX ELEMENTS

Options

Option Description
-e file error file for database update errors
-f used with the -v or -V option; shows information for the next (future) update; by default information for past updates is displayed
-h display help
-l file log file to write all status and errors information
-m nn maximum number of errors (default 10000)
-u nn display '*' every nn input records
-v verbose mode, 1 line per record
-x exclusive use of the database, no group locks taken
-H display verbose help screen
-V very verbose output, also 1 line per record

input_spec/output_spec

The input/output specification can specify one or more of the following parameters

Parameter Description
blockmax=nnn (S) the maximum size, in blocks, of a serial device
blocksize=nnn the block size to read/write to TTY/SERIAL device or file
device=file%dev (S) the file name for SERIAL device. Can be more than one
end=timespec (I) time in log set at which to stop restore/duplication
noflush=true (O) suppress flush of output at end of transaction. (default false)
notrans=true (O) ignore transaction boundaries. (default false)
prompt=true prompt when switching serial devices or files
rename=from,to convert path name directories ‘from’ to ‘to’ on restore
renamefile=file (O) use rename file list of format ‘from,to’ to rename files
retry=nn (I) specifies the interval between retries, when 'terminate=wait'
set=current (IL) begin restore/duplication using the current log set as input
set=database (OD) output is to the database, i.e. Restore mode
set=eldest (IL) begin restore/duplication using the eldest log set
set=n (ILN) begin restore/duplication using log set number n
set=null (O) output is to be discarded
set=serial (S) input/output is to a serial device or file. Requires ‘device=’
set=stdin (IT) the input data comes from the terminal stdin
set=stdout (OT) the output data is directed to the terminal stdout
set=tty (T) the input is from stdin or the output is to stdout
set=logset (OL) the output is directed to the current log set as an update
start=timespec (I) time in log set at which to start restore/duplication
terminate=eof (I) terminate restore/duplication at eof of eldest log set
terminate=eos (I) terminate restore/duplication at end of current log set
terminate=wait (I) switch to elder log sets as required and wait for new updates
timeout=nnn (I) timeout period in seconds for ‘terminate=wait'
verbose=true display to stderr a summary of the specification

The indicators in brackets denote:

Indicator Meaning
D specification valid for type database
I specification valid for type input
O specification valid for type output
L specification valid for log set
N specification valid for type of null
S specification valid for type serial
T specification valid for type terminal

timespec

The time specification, used in the ‘start=’ and ‘end=’ specification can be one of the following formats:

timespec meaning
hh:mm:ss time of day (todays date assumed)
DD-MMM-YYYY date (midnight assumed), Any date convention accepted
hh:mm:ss,DD-MM-YYYY both time and date specified either way around
jbackup_file time of file created. Use with 'jbackup -sfilename' option
filename regular file, use the time the file was last modified

 

LOGFILE

The transaction journal log can be accessed via a special file. The CREATE-FILE command can be used to create the file stub:

CREATE-FILE TJ1 TYPE=TJLOG
[ 417 ] File TJ1]D created , type = J4
[ 417 ] File TJ1 created , type = TJLOG

This creates an entry in the current directory:

TJ1
JBC__SOB jBASE_TJ_INIT SET: set=current terminate=eos

When a file of type TJLOG is created a set of dictionary records are generated in the dictionary section of the TJLOG file, which is a normal j4 hash file. The data section of a TJLOG file is handled by a special JEDI driver, which accesses the current log set. The log set can be changed by additional parameters when creating the TJLOG file after the TYPE specification. e.g.

CREATE-FILE TJ2 TYPE=TJLOG set=eldest

The following record types are used in the transaction journal log (see dictionary item TYPE).

Type Description
EOF end of file
WRITE record Written
DELETE record Deleted
CLEARFILE file Cleared
DELETEFILE file Deleted
CREATEFILE file Created
TRANSTART transaction Started
TRANSEND transaction Committed
TRANSABORT transaction Aborted

The jlogdup command enables selective restores to be performed by preceding the jlogdup command with a select list. The select list can be generated from the log set by generating a special file type, which uses the current log set as the data file.

 

EXAMPLE

:CREATE-FILE TJFILE TYPE=TJLOG
[ 417 ] File TJFILE]D created , type = J4
[ 417 ] File TJFILE created , type = TJLOG

:SSELECT TJFILE WITH PATH EQ "/home/jdata/CUSTOMER" AND WITH TYPE NE "CLEARFILE"

167 Records selected

>jlogdup INPUT set=current OUTPUT set=database

In this example, all updates to the CUSTOMER file which have been logged, except for any CLEARFILEs, are re-applied to the CUSTOMER file.


Transaction Journaling