|
sunil K Tripathi wrote: > > There may be packed flds of different lengths in the string. So I was > wondering how will i use the data structure approach ? - Use a data structure with a 30-digit packed field. - Move your character field right-adjusted to the data structure, with the left-most bytes of the DS set to x'00' - Assign the packed field to a 30-digit zoned field. - The value you want is in the zoned field. D packedChar ds D packedVal 30p 0 D zonedChar ds D zonedVal 30s 0 D len s 10i 0 D msg s 52 C *entry plist C parm parm 16 C eval len = %len(%trim(parm)) C evalr packedChar = %trim(parm) C eval %subst(packedChar : 1 : 16 - len) C = *allx'00' C eval zonedVal = packedVal C eval msg = %char(zonedVal) C msg dsply C return call thispgm x'12345F' dsply 12345 call thispgm x'12345D' dsply -12345 Barbara Morris
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.