PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Peter.Higgins on November 21, 2020, 02:21:32 PM

Title: Iolist for internal keys
Post by: Peter.Higgins on November 21, 2020, 02:21:32 PM
Is there a way in 2017 or later to write an IOlist for an internal mulitple field key so that the leading fields are padded with nuls?  LEN & CHR do not seem to have that ability.
Title: Re: Iolist for internal keys
Post by: Mike King on November 22, 2020, 10:11:00 PM
Not certain what you are attempting to do but if what you want is to generate a key for a file knowing the fields then you probably just need to use the KEY function.

For example if you have a  multi-segment key of something like productno, ciientno, and date as key number 3, you can generate a key string with:

k$ = KEY(fileno, kno=3, key=productno$:clientno$:date$)

This will insert any required padding and return you a key based on the values you provided.