Data Dictionary stripping keys on update

Started by James Zukowski, September 17, 2026, 12:00:06 PM

Previous topic - Next topic

James Zukowski

Some of our files are still using external keys. During F/M, the key value may not fill the field, so we are manually padding it to the full length.

With a Data Dictionary definition for the file set up having all discrete Delimited fields, the external key field is specified. If we need to update the file, however, the key value is stripped of trailing spaces in the updated file, even though the data field still retains them.

Is there any way to prevent this?
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

EVa

In the dictionary, in the field that makes up the external key, did you select 'Padded' instead of 'Fixed' ?

James Zukowski

James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Jane Raymond

If you want it to be fixed but with a delimiter, try defining the field as Last Substring. In the data it will be treated like Fixed with a delimiter added, i.e. padded when written and stripped when read. The external key value will be treated as padded.  See:
https://manual.pvxplus.com/page/Data%20Dictionary/Data%20Dictionary%20Maintenance/Element%20Description.htm
Jane Raymond

James Zukowski

The thing, though, is that we don't want is stripped at all. We already do all the processing on it to keep it padded in our application and for downstream apps.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Jane Raymond

Last Substring will pad and add a delimiter when written. It's only when reading that the data field is stripped.
Jane Raymond

James Zukowski

So there's no real way to prevent it from being stripped in a file update that will leave both the key and data intact before/during/after reading/writing.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Jane Raymond

I need some clarification. You say:
"If we need to update the file, however, the key value is stripped of trailing spaces in the updated file..."
Are you referring to updating the file within File Maintenance, or some other way like a dictionary update?
Jane Raymond

James Zukowski

It's with a DD update. We updated a definition, which has an external-only single-field key, which required a copy-update. Post-update, the keys had been stripped. We wound up building a quick program to run through and re-write the records with padded keys while removing the incorrectly-keyed records.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services

Jane Raymond

I created a file with an external key where all fields were delimited, and the key was the first field. I then wrote some records where the key and first field were padded. I then updated the file using a dictionary update, and the spaces in the key were lost, like you said. This is expected, as the key field was delimited, and the last segment of a delimited key will be stripped.
I then went into Dictionary Maintenance and changed the first field to be 'Last Substring' and did a dictionary update which copied the data. The result was that the key remained padded, as well as the first data field. So you should try changing the format of the key field to 'Last Substring'.

If this doesn't work for you, you might consider attaching an embedded IO procedure to your file that would intercept and control your I/O procedures:
https://manual.pvxplus.com/page/PxPlus%20User%20Guide/File%20Handling/Embedded%20IO%20Procedures/Overview.htm
Jane Raymond

James Zukowski

We only ran into this recently, and only when doing an "Update File" from the DD F/M. The data and key structure has been around for YEARS, and we've done the manual padding to deal with it.

We'll probably just note that any such updates to this or similarly-constructed files will need some special attention.

Thanks for checking into it.
James Zukowski
Sr. Developer - J&E

BRAND>SAFWAY
Brand Industrial Services