Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

REXX and Packed Decimal.

Status
Not open for further replies.

ringd

Programmer
Jul 11, 2000
35
0
0
GB
How can I read packed decimal record fields using REXX/MVS?<br>(we don't have the P2D function).
 
Use C2X, pull off the last character, this will leave you with the core number. You can analyze the last character to determine the sign if required.<br><br>Ex.<FONT FACE=monospace> <br>packed = '0012345D'x&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* sample starting value&nbsp;&nbsp;&nbsp;&nbsp;*/<br>unpked = c2x(packed)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/* gives you 0012345D&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;*/<br>sign&nbsp;&nbsp;&nbsp;= right(unpked,1)&nbsp;&nbsp;/* get right most character */<br>num&nbsp;&nbsp;&nbsp;&nbsp;= left(unpked,length(unpked)-1) /* remove sign */<br><br>if sign = 'D' then num = -num</font><br><br>Hope this helps <A HREF="mailto:mcampbel@wellsfargo.com">mcampbel@wellsfargo.com</A>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top