Navigation:  Reference > Commands >

Record Number Get/Set

Print this Topic Previous pageReturn to chapter overviewNext page

 

This command will either return the record number (position) of an active record, or will use the value supplied to read a record.

 

RCN fn/v   Required - The number/handle of the file to be used.

 

RCN fn/v Required - The field that will either hold the results of a GET or provide the value for a SET.  This must be an R type field.

 

do_whatGET / SET - GET the current record number, or SET the value in the record_number_field (the second RCN value) into the appropriate location and read the record.

       

NLOCKNormally, in multi-user mode, when a record is read it is automatically locked so that other users cannot read it until you are finished with it.  If this is a SET operation and you don't want to lock the record upon reading it then include this option in the command.

 

       NOTE:  If you include this option and another user reads the record and then you try to save the record back to disk you will get an error message telling you that this has occurred.   You need to read the record again before saving it back to disk.

 

Example

Find record

RCN @BoxCount_hndl rcn RecNum SET  //this will set/find the record number using the RecNum Value

Get Record Number

RCN @BoxCount_hndl rcn RecNum GET // this will get the record number and place the value in the Recnum fld

or use the Rcn()

SEE ALSO

RCN()

 

NOTE: If after getting the record position, you have found a record in the file using a different index, you must find it again using the same index before using the RCN command to return to the original record.

Example:

Define SomeRCN type R

Findv M fnum SomeFile_hndl key Index1 val SomeValue

SomeRCN = rcn(SomeFile_hndl) // Gets the record position

Findv M fnum SomeFile_hndl key Index2 val AnotherValue // Found the record with a differing index

Findv M fnum SomeFile_hndl key Index1 val Anyvalue nlock // Find using the same index as original

Rcn @SomeFile_hndl rcn SomeRCN set // Finds the original record with the same index

 

 


Page url: http://www.cassoftware.com/tas/manual/recordnumbergetset.htm