Nonstop Database, HiRDB Version 9 UAP Development Guide
![[Contents]](FIGURE/CONTENT.GIF)
![[Index]](FIGURE/INDEX.GIF)
![[Back]](FIGURE/FRONT.GIF)
Appendix H.3 Function for conversion to a DECIMAL signed normalized number
The function for conversion to a DECIMAL signed normalized number sets the sign for DECIMAL data to either X'C' or X'D' (for a value of 0, the sign is X'C'). Because this function lets you obtain the normalized sign without having to store DECIMAL data in a database, you can use it for the following purposes:
- To evaluate whether the data to be stored will be partitioned equally when pd_dec_sign_normalize=Y is specified in the system definition and the key for partitioning a table is determined by the key range
- To create an input data file for each RDAREA when pd_dec_sign_normalize=Y is specified in the system definition and data is loaded to a key-range-partitioned table in units of RDAREAs concurrently using the database load utility
- Prerequisites for using the function for conversion to a DECIMAL signed normalized number
- The prerequisites are the same as those for the hash function for table partitioning. For details, see H.1(1) Prerequisites for using the hash function for table partitioning.
- Prerequisites for creating and executing a UAP using the function for conversion to a DECIMAL signed normalized number
- The prerequisites are the same as those for the hash function for table partitioning. For details, see H.1(2) Creating and executing UAPs that use the hash function for table partitioning.
- Organization of this subsection
- (1) Details about the function for conversion to a DECIMAL signed normalized number
(1) Details about the function for conversion to a DECIMAL signed normalized number
(a) Specification configuration
For details about the specification configuration, see H.1(3)(b) Specification configuration.
(b) Function for conversion to a DECIMAL signed normalized number (p_rdb_dec_sign_norm)
- Function
- The function normalizes the sign of DECIMAL data indicated by srcp as follows:
Before normalization |
After normalization |
X'A' |
X'C' |
X'B' |
X'D'# |
X'C' |
X'C' |
X'D' |
X'D'# |
X'E' |
X'C' |
X'F' |
X'C' |
X'0' to X'9' |
Error |
#: If the absolute value of data is 0, the sign part is set to X'C'.
- Header file
- #include<pdauxcnv.h>
- This header file is required to use the function for conversion to a DECIMAL signed normalized number.
- Format
int p_rdb_dec_sign_norm(unsigned char *srcp,
short srcl,
unsigned char *destp);
|
- Arguments
- srcp (input)
- Specifies the start address of the DECIMAL data to be normalized.
- srcl (input)
- Specifies the length code of the DECIMAL data indicated by the srcp argument. Specifiable data length codes are as follows:
Data type |
Data length code |
INTERVAL YEAR TO DAY |
8 x 256 |
INTERVAL HOUR TO SECOND |
6 x 256 |
DECIMAL[(p[,q])] |
p x 256 + q
(If p is omitted, 15 is assumed; if q is omitted, 0 is assumed.) |
- destp (output)
- Sets the normalized DECIMAL data. Allocate this area indicated by destp on the side that calls the function for conversion to a DECIMAL signed normalized number.
- Return values
- data type: int
- p_rdb_RC_RTRN(0)
- Normal termination.
- p_rdb_RC_ERRDFRM(-12)
- Invalid sign part for data.
- Notes
- The function does not check anything for error other than the sign part of DECIMAL data. Operation is not guaranteed if DECIMAL data is invalid or the data length code specified by the srcl argument contradicts the DECIMAL data.
- Operation is guaranteed if the data input area is the same as the data output area, or if the output area is located before the input area and the latter half of the output area overlaps the first half of the input area.
All Rights Reserved. Copyright (C) 2011, Hitachi, Ltd.