SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
C Sample Programs
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
A-22
Using a Dynamic SQL Cursor With Descriptor Area
 printf (" Value: %f\n", hv_double);
 } else printf (" Value: %.f\n", hv_double); 
 break;
case 5:
 printf ("Smallint: %s, Type: %d, Precision: %d," 
 " Scale: %d,\n Length: %d, Null: %d",
 hv_name, hv_type, hv_precision, 
 hv_scale, hv_length, hv_indicator);
 EXEC SQL GET DESCRIPTOR 'out_sqlda' VALUE :i
 :hv_short = VARIABLE_DATA;
 printf (" Value: %hd\n", hv_short); 
 break;
 case -411:
 printf ("Float: %s, Type: %d, Precision: %d," 
 " Scale: %d,\n Length: %d, Null: %d",
 hv_name, hv_type, hv_precision, 
 hv_scale, hv_length, hv_indicator);
 EXEC SQL GET DESCRIPTOR 'out_sqlda' VALUE :i
 :hv_real = VARIABLE_DATA;
 printf (" Value: %f\n", hv_real); 
 break;
 case -412:
 printf ("Real: %s, Type: %d, Precision: %d," 
 " Scale: %d,\n Length: %d, Null: %d",
 hv_name, hv_type, hv_precision, 
 hv_scale, hv_length, hv_indicator);
 EXEC SQL GET DESCRIPTOR 'out_sqlda' VALUE :i
 :hv_real = VARIABLE_DATA;
 printf (" Value: %LE\n", hv_real); 
 break;
 case -413:
 printf ("Double: %s, Type: %d, Precision: %d," 
 " Scale: %d,\n Length: %d, Null: %d",
 hv_name, hv_type, hv_precision, 
 hv_scale, hv_length, hv_indicator);
 EXEC SQL GET DESCRIPTOR 'out_sqlda' VALUE :i
 :hv_double = VARIABLE_DATA;
 printf (" Value: %LE\n", hv_double);
 break;
 case 9:
 switch (hv_datetime) {
 case 1:
 memset(hv_date,' ',sizeof(hv_date));
 EXEC SQL GET DESCRIPTOR 'out_sqlda' VALUE :i
 :hv_date = VARIABLE_DATA;
 hv_date[hv_length]=0;
 printf ("date Value: %s\n", hv_date); 
 break;
Example A-7. Using a Dynamic SQL Cursor With Descriptor Areas (page 5 of 8)










