SYS(2017) - Record Checksum Value

Returns a checksum value based on the current record in the current work area. You can use a checksum to test the validity of data. You can also generate checksum values greater than 16 bits for large strings.

SYS(2017) offers complementary functionality to SYS(2007) - Checksum Value.

SYS(2017, cExpression [, nSeed [, nFlags]])

Parameters

cExpression

Specifies a comma-delimited list, with or without spaces, containing one or more fields to exclude from the checksum calculation. The maximum length of the field string is limited to 256 characters.

If cExpression is empty, Visual FoxPro does not exclude fields except for Memo and General fields.

nSeed

Specifies a numeric seed value of 0 that is used to calculate the checksum and is included for backward compatibility. Passing a value of -1 for nSeed uses the default system value of 0. For CRC32 calculations, Visual FoxPro disregards nSeed.

nFlags

Specifies additive bit values for generating the checksum.

Versions of Visual FoxPro earlier than 8.0 used a CRC16 16-bit algorithm to calculate the checksum values of strings. Visual FoxPro now includes the CRC32 routine to calculate larger 32-bit values. You can control the setting of this algorithm by setting the first bit value of the nFlags parameter.

The following table lists the bit values you can add to produce a value for nFlags.

Value Bits Description

1

001

Calculate checksum value using CRC32 checksum algorithm.

2

010

Include Memo fields in the checksum calculation.

You can use the second nFlags bit to include Memo fields in the CRC calculation. Visual FoxPro includes all Memo fields except any specified by cExpression in the calculation.

The following table lists the possible values for nFlags, produced by the sum of the bit flags.

nFlags Description

0

Calculate checksum based on cExpression parameter using CRC16 checksum algorithm. (Default)

1

Calculate checksum based on cExpression parameter using CRC32 checksum algorithm.

2

Calculate checksum based on current record contents including Memo fields using CRC16.

3

Calculate checksum based on current record contents including Memo fields using CRC32.

Expand imageReturn Value

Expand imageRemarks

Expand imageSee Also


© , 1996-2020 • Updated: 11/10/20
Comment or report problem with topic