🛠️ P3/COBOL 25.1.0-SNAPSHOT is available for preview.
Reference Manual
P3-Utility
Volume Utility

Volume Utility Commands

Indexed volume utilities

p3 volume volumeCommand [ volumeArgs ]\mathsf{p3} \space \mathbf{volume} \space \mathsf{volumeCommand} \space \begin{bmatrix} \space \mathit{volumeArgs} \space \end{bmatrix}

The volumeCommand s are:

Volume Command NamePurpose
apply-diffApplies a diff log (or deflated log) to volume
backupBacks up a volume to a file (or deflated file)
checkChecks a volume to ensure all files are uncorrupted and readable
check-diffChecks a diff log (or deflated log) against a volume to ensure that it can be successfully applied
compactCompacts volume(s) at the first quiescent opportunity
deleteDeletes file(s) from specified volume
detailPrints file(s) structure details to stdout
diffCreates a diff log (or deflated log) reflecting the changes required to the from volume in order to match the to volume
dumpDump the file(s) on the specified volume(s) as a diff log (or deflated log) capable of recreating the volume when applied to a disjoint (possible empty) volume
listList the file(s) on the specified volume(s)
renameRename the file in the specified volume to the new file name specified
rewrite-volumeRewrite a legacy 25.0- volume into the current H2 2.4 MVStore format
undeleteRestore logical file name entries for anonymous (deleted) file maps
help
h
?
Help

Assume there is a volume named artists.mvc with the following file in it:

  • artists_v1
  • artists_v2
  • artists_v3

apply-diff

This command applies a previously generated diff log to the volume specified by the fromVolumePath. The -z option indicates a deflated (zipped) log file should be assumed.

p3 v apply-diff artists.bak artists.diffLog

backup

This command produces a backup copy of the indicated indexed file volume at the specified path. The -z option indicates a deflated (zipped) backup volume is to be produced. The resulting backup volume may be later copied to the original volume location and then used, or it may be used as is in the location provided by this command. If deflated, it should be re-inflated (unzipped) before use. The backup command may be used with quiescent volumes (with no files open) or with active volumes (files open at the time of backup). In the latter case, the backup will result in a backup that reflects the state of the volume at the instant the backup is started. Any file operation or transaction that is in progress at that time will not be reflected in the backup that is produced. Any operations or transaction completed before the backup begins will be included in their entirity.

p3 v backup artists.mvc artists.bak

To get a zipped backup, just add the option -z.

p3 v backup artists.mvc artists.zip -z

check

This command checks the indexed file volume at the indicated location to ensure all data is readable and could be backed up if desired. Any data inconsistencies or corruption that could prevent successfully accessing the data in the volume will be noted.

p3 v check artists.mvc

check-diff

This command checks the diff log at the indicated location to ensure that it could be successfully applied to the volume indicated. The indicated volume may be a previously written backup volume, or it may be an operational volume. If the latter, it should be quiescent, but is not required to be. In any case, it usually should be equivalent to the volume from which the diff was produced.

p3 v check-diff artists.mvc artists.diffLog

compact

This command causes the indicated volume(s) to be compacted (reduced to minimal physical storage). If the volume(s) are not quiescent, the compaction will be deferred until a time at which they are.

p3 v compact artists.mvc

delete

This command deletes the file(s) indicated that are contained by the volume indicated. The storage associated with the deleted files will be reclaimed when/if the volume is compacted. Until that time, the file remains in the volume as an anonymous file.

p3 v delete artists.mvc artists_v3
 
p3 v list artists.mvc
Active files for volume artists.mvc:
artists_v1
artists_v2

detail

This command writes detailed information regarding the indicated structure of the file(s) contained in the indicated volume.

p3 v detail artists.mvc artists_v1
{
    record-count=10,
    max-record-length=10,
    version=1,
    min-record-length=5,
    key-count=1,
    uuid=ab2f292f-bc0a-442b-9723-2d4a0f8a72e8,
    key-0=u_0_5
}

diff

This command produced a diff log file by comparing the specified from volume to the specified to volume. The log produced can be subsequently applied to the from volume (or a backup of that volume) resulting in a volume equivalent to the to volume. This can be used for incremental backups consisting of only the differences between a prior backup and the current state of an operational volume. In such cases, the from volume should be quiescent (as would be the case with a backup volume). The -z option indicates a deflated (zipped) log file should be produced.

p3 v diff artists.mvc artists.bak artists.diffLog

dump

This command produces a diff log similar to the diff command, except that the from volume is assumed to be an empty volume, and the to volume is the one specified by this command. The result is a diff log capable of reconstructing the specified volume contents from scratch. The diff log can be read and processed by a COBOL program for any purpose, including its application to a foreign file system, if necessary. Essentially, this command allows the record-based contents and all file details to be dumped for later processing as needed.

p3 v dump artists.mvc artists.dump

list

This command lists the files contained in the indicated volume(s).

p3 v list artists.mvc
Active files for volume artists.mvc:
artists_v1
artists_v2

rename

This command renames the indicated current file name to the new file name on the specified volume. Note that if this command is used, diff logs produced prior to the change may not be applied to the volume after the rename operation. New logs, however, can be produced and will reflect the effective deletion of the previous file and the addition of all the records comprising the file as the new file.

p3 v rename artists.mvc artists_v2 artists_v2_renamed
 
p3 v list artists.mvc
Active files for volume artists.mvc:
artists_v1
artists_v2_renamed

rewrite-volume

This command converts a legacy P3/COBOL 25.0- (H2 1.4-era) MVCC volume to the current H2 2.4 on-disk format used by P3/COBOL 25.1. When only the source path is supplied, the rewrite is performed in place: a byte-for-byte golden backup is written first as <volume>.bak_<fletcher> (Fletcher-32 of the v1 file, logged at INFO), verified readable with the legacy reader, and only then is the live path replaced with the v2 volume. When a target path is also supplied, the rewritten volume is written to that path and the source is left unchanged (no .bak_<fletcher> is required for that mode).

p3 v rewrite-volume artists.mvc
p3 v rewrite-volume artists.mvc artists-2.4.mvc

Opening a legacy volume with the 25.0 runtime performs the same in-place conversion automatically unless autoRewriteLegacyVolumes is set to false. See Upgrading Existing MVCC Volumes.

undelete

This command restores p3.name map entries for anonymous file-structure (p3.ffa_*) maps — file data that remains after a logical delete (or that lost its name mapping) until compaction removes it. Restoring a name makes the file visible again to list, detail, and normal opens. An optional logical file name may be supplied when the volume contains a single anonymous file (for example, when the volume path suggests the COBOL file name).

p3 v undelete artists.mvc
p3 v undelete my_songs.mvc songs

The volume must not be open by another process. rewrite-volume performs undelete automatically as part of conversion so a live file from the pre-rewrite volume (retained as .bak_<fletcher> on in-place rewrite) can be opened by name on the rewritten volume.