Use the P2D() function to convert an IBM packed-decimal number into a REXX-format whole number.
The P2D() function has this syntax:
number = P2D(pdec)
The P2D() function takes these arguments:
Whole number.
Packed-decimal number. Each byte contains 2 decimal digits, except the right-most byte, which may contain a sign digit (hexadecimal F for positive, B for negative) in the right half of the byte.
The P2D() function produces these return codes:
ARG 1 MISSING OR INVALID
Example
/* Unpack a julian date from ISPF statistics format */
parse arg value /* date: 00 yy dd dF */
julian = p2d(value) /* REXX number */
final = right(insert('.',julian,length(julian)-3),6,'0')
/* yy.ddd */
| Copyright © 2012 CA. All rights reserved. | Tell Technical Publications how we can improve this information |