|
Scott, Bob, Matt, and others, Thank you for the explanations! I had thought since MOVE is not supported in free-format, there would have been an alternative BIF to do what I wanted. I like the overlay idea, too, so I may use that. The field is in a vendor supplied file and I do not know why they chose to define a numeric field as character and populate it using that format. It isn't something that I am allowed to change. Thanks for the information! -Mike rpg400-l-bounces@xxxxxxxxxxxx wrote on 03/09/2006 03:50:37 PM: > The data in your field is not human-readable character data. You could > not reasonably expect a user to see "100N" and know that it means -1005. > > The %DEC() and %INT() BIFs are expecting human-readable character data. > For example, it could be ' -1234' or ' -85.65' and they'd have no > trouble interpreting it. But '00000856N'they won't understand because > it's not human-readable character data. > > What you have in your field is the contents of a zoned decimal field. I'm > curious as to why you have this loaded into a character field in your > program. Why not read it into a zoned decimal field in the first place? > When you read the file, just code the field as zoned decimal. (Either in > the external definition, or in the I-spec if it's program described.) > > IF for some obscure reason you can't do that, you can either use the MOVE > op-code (as you've already discovered) or you can simply overlay the > character field with a zoned field in a data structure. For example: > > D ds > D myCharFld 9A > D myZonedFld 9S 2 overlay(myCharFld) > > /free > > myCharFld = '00000856N'; > // myZonedFld now contains -85.65.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 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.