dc_frdec()

Converts a long integer variable to a decimal string for display in a field

Call  
#include <vv_dec.h>
int dc_frdec(stp, datap, dfldp, cvbufp)

UCHAR *stp

Pointer to a string buffer

PTR datap Pointer to data variable containing a long integer
DFIELDPTR dfldp Pointer to a data field structure
PTR cvbufp Pointer to a data conversion buffer
Returns  
1 The long integer was successfully converted to a decimal string
0 The string exists, but it is too long to fit in the field
Description

dc_frdec() first converts the long integer to a string and then inserts a decimal separator into the string at the position specified by the picture for the field. Zeros are inserted, if necessary. For instance, if the string is "12" and the picture is "9.999", the resulting string is "0.012".

If thousands separators are specified (THSEPARATOR is ON for the field), they are inserted as needed. If inserting thousands separators makes the string too long to fit in the field, they are not inserted.

If right justification of the string is specified (RTADJUST is ON for the field), spaces are inserted in the string as needed.

The length of the string is checked to ensure that it will fit in the field. If it doesn't fit, dc_frdec() returns a zero.

If BLANKONZERO is ON and the value is zero, the returned string will only contain protected characters. All zeroes will have been replaced with spaces.

Related Functions

dc_todec(), vf_dec()

Cautions

This function assumes that the string buffer is large enough to hold the resulting string, including a null terminator '/0'.

A string that is too long for the field is not considered a fatal error. VV_ERR does not get set; therefore, the VCS error reporting system does not report this condition.


Home Contents Previous Next