|
Tony Carolla wrote: > > I am writing to a file, and one of the fields is a 150 Alpha VARLEN > field. This file will contain a large number of history records, and > I am doing this to conserve space: > ... > In debug, I see that the DS has the correct length set (52) using %Len > to test the length. But when I write, the field in the DB file > contains all 150 characters, with trailing spaces added. Is there a > trick to making the WRITE op recognize the DS variable length, that > the compiler created for me, based on the file structure, or do I have > to eval %Trim from the DS to the actual file buffer fields? > How are you determining the actual data in the file? If you're using DSPPFM, the position of the other fields in the record will be fixed, so DSPPFM has to show something in those unused bytes. Try doing F10 F11 to see the hex value of the record, so you can see the 2-byte length part of the varying field. For this file: A R REC A FLD1 10A A FLD2 10A VARLEN A FLD3 10A My record has values FLd1='aaaaaaaaaa', FLD2='bbb', and FLd3='cccccccccc'. DSPPFM and it shows this: aaaaaaaaaabbb cccccccccc With F10 then F11, it shows this. The xx marks the 2 length bytes for FLD2 (value x'0003' = 3). xx aaaaaaaaaabbb cccccccccc 88888888880088844444448888888888 11111111110322200000003333333333
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.