Skip to main content

[Migrated content. Thread originally posted on 29 March 2012]

I was wondering about NULLS and the SQL GET DATA sql-QueryHandle command.

When I do the SQL GET DATA command, and my results has NULLS in it, how are the fields populated? Are the Numeric fields populated with zeros, or nothing? Are the AlphaNumeric fields populated with "NULL"??

Just need to know so I can handle NULLS correctly within my COBOL program.

[Migrated content. Thread originally posted on 29 March 2012]

I was wondering about NULLS and the SQL GET DATA sql-QueryHandle command.

When I do the SQL GET DATA command, and my results has NULLS in it, how are the fields populated? Are the Numeric fields populated with zeros, or nothing? Are the AlphaNumeric fields populated with "NULL"??

Just need to know so I can handle NULLS correctly within my COBOL program.
if you try is to read and validate numeric fields, I suggest you better read the numerical data of the database and receive alphanumeric variable in cobol in, and eventually you pass the variable to a variable numerical alfanuerico Cobol.

[Migrated content. Thread originally posted on 29 March 2012]

I was wondering about NULLS and the SQL GET DATA sql-QueryHandle command.

When I do the SQL GET DATA command, and my results has NULLS in it, how are the fields populated? Are the Numeric fields populated with zeros, or nothing? Are the AlphaNumeric fields populated with "NULL"??

Just need to know so I can handle NULLS correctly within my COBOL program.
if you try is to read and validate numeric fields, I suggest you better read the numerical data of the database and receive alphanumeric variable in cobol in, and eventually you pass the variable to a variable numerical alfanuerico Cobol.

[Migrated content. Thread originally posted on 29 March 2012]

I was wondering about NULLS and the SQL GET DATA sql-QueryHandle command.

When I do the SQL GET DATA command, and my results has NULLS in it, how are the fields populated? Are the Numeric fields populated with zeros, or nothing? Are the AlphaNumeric fields populated with "NULL"??

Just need to know so I can handle NULLS correctly within my COBOL program.
if you try is to read and validate numeric fields, I suggest you better read the numerical data of the database and receive alphanumeric variable in cobol in, and eventually you pass the variable to a variable numerical alfanuerico Cobol.

[Migrated content. Thread originally posted on 29 March 2012]

I was wondering about NULLS and the SQL GET DATA sql-QueryHandle command.

When I do the SQL GET DATA command, and my results has NULLS in it, how are the fields populated? Are the Numeric fields populated with zeros, or nothing? Are the AlphaNumeric fields populated with "NULL"??

Just need to know so I can handle NULLS correctly within my COBOL program.
The answer is in the help file in the topic for the SQL GET DATA statement:

DataItemN (output). This argument may refer to any COBOL data item that is consistent with the data type of the column being transferred. The argument specifies the data item where the column data value is to be transferred. If the column value is NULL in a fetched row, InstantSQL stores binary zeroes into the data item, but an application should use the value stored in the LenIndN argument to detect NULL values.

LenIndN (output). This argument must refer to a signed numeric integer data item with at least nine digits of precision. The argument specifies the data item where the length indicator value for the specified column is to be transferred. The value sql-Null-Data is transferred into the length indicator for NULL column result values. Otherwise, the length of the result value is transferred. The length of the column result value may be zero for zero length character data in the database. This argument must be present, but the word OMITTED may be specified as a placeholder to explicitly ignore the length indicator value, for example, when NULL column values are not expected.


The reason that the LenIndN argument should be checked is that the value returned could be legitimately binary zeroes for a non-null result. When the LenIndN argument has the value sql-Null-Data, then one knows that the data base contained a true NULL.

[Migrated content. Thread originally posted on 29 March 2012]

I was wondering about NULLS and the SQL GET DATA sql-QueryHandle command.

When I do the SQL GET DATA command, and my results has NULLS in it, how are the fields populated? Are the Numeric fields populated with zeros, or nothing? Are the AlphaNumeric fields populated with "NULL"??

Just need to know so I can handle NULLS correctly within my COBOL program.
Oh! Ok Bruce. Thanks!!
I think someone over there @ MicroFocus should re-write that InstantSQL help. I find it very confusing, and the examples are horrible.