UNSPEC
UNSPEC returns a bit string that is the internal coded form of x.
- x
- Scalar, array, structure, or union expression.
The UNSPEC built-in function is subject to the following
rules:
- Under the compiler option USAGE( UNSPEC(IBM) ),
- UNSPEC of structure references and expressions is not allowed.
- UNSPEC of an array yields an array of BIT.
- Under the compiler option USAGE( UNSPEC(ANS) ),
- For aggregates, UNSPEC is allowed only for those that contain no padding bytes or bits.
- The result will always be BIT scalar. UNSPEC of an array does not yield an array of BIT.
Note: Use of UNSPEC can affect the portability of your program.
The length of the returned bit string depends on the attributes of x, as shown in Table 1.
| Bit string length | Attribute of x |
|---|---|
| 8 | SIGNED FIXED BINARY(p,q), 1 <= p <= 7
UNSIGNED FIXED BINARY(p,q), 1 <= p <= 8 ORDINAL SIGNED PRECISION(p), 1 <= p <= 7 ORDINAL UNSIGNED PRECISION(p), 1 <= p <= 8 |
| 16 | SIGNED FIXED BINARY(p,q), 8 <= p <= 15
UNSIGNED FIXED BINARY(p,q), 9 <= p <= 16 ORDINAL SIGNED PRECISION(p), 8 <= p <= 15 ORDINAL UNSIGNED PRECISION(p), 9 <= p <= 16 |
| 32 | ENTRY LIMITED, under LP(32)
SIGNED FIXED BINARY(p,q), 16 <= p <= 31 UNSIGNED FIXED BINARY(p,q), 17 <= p <= 32 ORDINAL SIGNED PRECISION(p), 16 <= p <= 31 ORDINAL UNSIGNED PRECISION(p), 17 <= p<= 32 FLOAT BINARY(p), 1 <= p <= 21 FLOAT DECIMAL(p), 1 <= p <= 6 if not DFP FLOAT DECIMAL(p), 1 <= p <= 7 if DFP OFFSET, under OFFSETSIZE(4) FILE constant or variable, under LP(32) POINTER(32) HANDLE(32) |
| 64 | ENTRY LIMITED, under LP(64)
SIGNED FIXED BINARY(p), 31 < p UNSIGNED FIXED BINARY(p), 32 < p FLOAT BINARY(p), 21 < p < 53 FLOAT DECIMAL(p), 7 <= p <= 16 if not DFP FLOAT DECIMAL(p), 8 <= p <= 16 if DFP OFFSET, under OFFSETSIZE(8) FILE constant or variable, under LP(64) LABEL constant or variable ENTRY constant or variable POINTER(64) HANDLE (64) |
| 128 | FLOAT BINARY(p), 54 <= p
FLOAT DECIMAL(p), 17 <= p TASK |
| n | BIT(n) |
| 8*n | CHARACTER(n) PICTURE (with character-string-value length of n) |
| 16*n | GRAPHIC(n) WIDECHAR(n) |
| 32*n | UCHAR(n) |
| 16+n | BIT(n) VARYING where n is the maximum length of x |
| 32+n | BIT(n) VARYING4 where n is the maximum length of x |
| 16+(8*n) | CHARACTER(n) VARYING where n is the maximum length of x |
| 32+(8*n) | CHARACTER(n) VARYING4 where n is the maximum length of x |
| 8+(8*n) | CHARACTER(n) VARYINGZ where n is the maximum length of x |
| 16+(16*n) | GRAPHIC(n) VARYING where n is the maximum length of x WIDECHAR(n) VARYING where n is the maximum length of x |
| 32+(16*n) | GRAPHIC(n) VARYING4 where n is the maximum length of x WIDECHAR(n) VARYING4 where n is the maximum length of x |
| 8+(16*n) | GRAPHIC(n) VARYINGZ where n is the maximum length of x WIDECHAR(n) VARYINGZ where n is the maximum length of x |
| 16+(32*n) | UCHAR(n) VARYING where n is the maximum length of x |
| 32+(32*n) | UCHAR(n) VARYING4 where n is the maximum length of x |
| 8+(32*n) | UCHAR(n) VARYINGZ where n is the maximum length of x |
| 8*(n+16) | AREA (n) under LP(32) |
| 8*(n+32) | AREA (n) under LP(64) |
| 8*FLOOR(n) | FIXED DECIMAL (p,q) where n = (p+2)/2 |
Alignment and storage requirements for program-control data can vary across supported systems.
If x is a VARYING or VARYING4 string, its length prefix is included in the returned bit string. If x is an area, the returned value includes the control information.
