Previous Topic: OSCMD()

Next Topic: PAUSE()

P2D()

Use the P2D() function to convert an IBM packed-decimal number into a REXX-format whole number.

Syntax

The P2D() function has this syntax:

number = P2D(pdec)

Arguments

The P2D() function takes these arguments:

number

Whole number.

pdec

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.

Return Codes

The P2D() function produces these return codes:

101

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            */