PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Question on key padding  (Read 130 times)

Peter.Higgins

  • Gold Member
  • ****
  • Posts: 67
    • View Profile
Question on key padding
« on: September 16, 2020, 11:22:56 AM »

From working with multiple keys I've learned that external keyed File keys are space padded and internal keyed Files keys are null padded.  Will the FIB "Extended Key Attributes" byte "Null character for NULL keys" affect the key padding or is this only for determining whether to write the key or not?

(6,2)
$0001$ Unique key
$0002$ Convert segment to uppercase
$0004$ Convert segment to lowercase
$0008$ Convert using translate table
$0010$ Swap byte order
$0020$ Primary key allows duplicates
$0040$ Don't add key if the segment is null
$0100$ Don't add key if all segments are null
$0200$ Binary auto-increment key
$0400$ Ignore data after $00$
$0800$ Zero-filled auto-increment
$1000$ Space-filled auto-increment

(8,1) Null character for NULL keys ((6,2)=$0040$ or $0100$)

EVa

  • Silver Member
  • ***
  • Posts: 24
    • View Profile
    • EDIAS
Re: Question on key padding
« Reply #1 on: September 17, 2020, 03:37:52 AM »
-:/
0010 BEGIN ; LET z$="D:/tmp/eraseme.dat"; ERASE z$,ERR=*NEXT
0020 DIM cfibrec$::"RecordCnt:C(3),Name:C(6),Format:C(1),ExternalKey:C(1),MaxRe
0020:cs:C(3),RecordSize:C(2),KeyedFileFlg:C(1),threshold:C(1),FileType:C(1),Ext
0020:ernalHandle:C(1),Unusedfields:C(4),Path:C(60),KeySegments:C(384)"
0030 KEYED z$,[1:1:4:"K:7F"],0,-256 ! or [1:1:4:"N:xx"]
0040 LET wrk=1; OPEN INPUT (wrk)z$
0050 LET cfibrec$=FIB(wrk); CLOSE (wrk)
0060 PRINT HTA(cfibrec::keysegments$(8,1))
-:run
7F

PxPlus stores what you call the 'null character' for K and N key attributes in that byte.

-Eric-

Peter.Higgins

  • Gold Member
  • ****
  • Posts: 67
    • View Profile
Re: Question on key padding
« Reply #2 on: September 17, 2020, 02:08:14 PM »
Thanks Eric.
The Keyed directive documentation was very helpful.  Been awhile since I read it.