|
>> In specific these are packed fields that have a value of Hex'00' in them..... Well hex zeros are OK is all bytes of the packed field except the last <g> First solution - if the whole field should be set to zero use FIXNBR(*INPUTPACKED) on the H-spec. Use this on every program that reads the file. If you suspect this was a one-time corruption, then write a simple program using this specification and loop through the file reading/writing every record. If it is just the sign nibble that has the incorrect value, then the code below (not tested but ..) will fix it simply for a 5 digit field. Adjust accordingly for other field lengths. D Fixup DS D TempPacked 7p 2 Inz D CharData 3a Overlay(Fixup) D 1a Overlay(Fixup:*Next) D Result S 5p 0 C Eval CharData = InpData * CharData now has X'123450' - Fixup has X'1234500F' C Eval Result = TempPacked * Result now has X'12345F' This example assumes that the field InpData contains a valid packed number (12345) _except_ that the sign is X'0' instead of X'F'. The field in the file is defined as character 3 and moved to the CharData field. The unnamed single character field that follows contains X'0F' by virtue of the fact that it redefines the last byte of TempPacked which is initialized to zero. Since TempPacked has two decimal places, when it is assigned to Result, the lowest order nibbles will be discarded and the low order sign "attached" to the integer portion of the number. This technique is a modification of the method used to translate unsigned packed fields imported from other platforms. Jon Paris Partner400
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 copyright@midrange.com.
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.