DSNH310I W Host Variable Declared in File Section

Donnie Woodruff

DSNH310I W Host Variable Declared in File Section
DB2L'ers:

Happy Holidays!

Recently a developer used a variable defined in the File Section as a Host
Variable for a DB2 query. This may be a ridiculous question, but can
someone tell me why DB2 might have a problem with it?

For a DSNH310I message, the DB2 Messages & Codes manual states:

If this host variable is used, the user assumes responsibility for possible
exposure of incorrect output. Refer to Section 3 of DB2 Application
Programming and SQL Guide to determine where host variables can be validly
declared. Declaring a COBOL host variable in the File Section might lead to
incorrect output from SQL statements or abend 04E with RC=00E7000C.

Thanks in advance.
Donnie

Donald W. Woodruff, Jr.
Systems Programmer/DBA
City of Newport News
2400 Washington Ave, 2nd Floor--IT Dept
Newport News, VA 23607
[login to unmask email]




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002



John McKown

Re: DSNH310I W Host Variable Declared in File Section
(in response to Donnie Woodruff)
Well, off hand, what is in the host variable if the file is CLOSEd? You
might be pointing to a non-existant piece of storage. Or if the file is
OPEN, but a READ had not been done. Or a READ is done, but EOF has been
signalled? In these cases, the status of the information in the FD is not
clearly defined. It may be junk, or it may not exist, or it may be the last
thing read.

--
John McKown
Senior Technical Specialist
UICI Insurance Center
Applications & Solutions Team
+1.817.255.3225


> -----Original Message-----
> From: Donnie Woodruff [mailto:[login to unmask email]
> Sent: Thursday, December 26, 2002 1:42 PM
> To: [login to unmask email]
> Subject: DSNH310I W Host Variable Declared in File Section
>
>
> DB2L'ers:
>
> Happy Holidays!
>
> Recently a developer used a variable defined in the File
> Section as a Host
> Variable for a DB2 query. This may be a ridiculous question, but can
> someone tell me why DB2 might have a problem with it?
>
> For a DSNH310I message, the DB2 Messages & Codes manual states:
>
> If this host variable is used, the user assumes
> responsibility for possible
> exposure of incorrect output. Refer to Section 3 of DB2 Application
> Programming and SQL Guide to determine where host variables
> can be validly
> declared. Declaring a COBOL host variable in the File Section
> might lead to
> incorrect output from SQL statements or abend 04E with RC=00E7000C.
>
> Thanks in advance.
> Donnie
>
> Donald W. Woodruff, Jr.
> Systems Programmer/DBA
> City of Newport News
> 2400 Washington Ave, 2nd Floor--IT Dept
> Newport News, VA 23607
> [login to unmask email]
>
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002
>
>
> To change your subscription options or to cancel your
> subscription visit the DB2-L webpage at
> http://listserv.ylassoc.com. The owners of the > list can be
>
>



Neil Courtney

Re: DSNH310I W Host Variable Declared in File Section
(in response to John McKown)
Donnie,
this may work if you are reading an unblocked file. If it is
blocked, then after each read the buffer pointers will be pointing to a
different bit of storage withing the buffer. Generally, a job will be run
with multiple (at least two, probably more) buffers for each file, so even
an unblocked file will not work.

The DB2 precompiler that resolves the address of the host variable for the
DBRM module will only be able, at best, to resolve this to a single address,
being the first record area of the buffer. At worst, it could be totally
spurious (I don't know the details of how the buffers are handled by a COBOL
program, assuming it is COBOL).

In other words, don't do it.

Cheers,
Neil Courtney
IS Consultant
IT Services / Legacy Systems
TelstraClear
mailto:[login to unmask email]
Ph. 64 09 912-4927
"MG - Life's too short not to"


-----Original Message-----
From: Donnie Woodruff [mailto:[login to unmask email]
Sent: Friday, December 27, 2002 8:42 AM
To: [login to unmask email]
Subject: DSNH310I W Host Variable Declared in File Section


DB2L'ers:

Happy Holidays!

Recently a developer used a variable defined in the File Section as a Host
Variable for a DB2 query. This may be a ridiculous question, but can
someone tell me why DB2 might have a problem with it?

For a DSNH310I message, the DB2 Messages & Codes manual states:

If this host variable is used, the user assumes responsibility for possible
exposure of incorrect output. Refer to Section 3 of DB2 Application
Programming and SQL Guide to determine where host variables can be validly
declared. Declaring a COBOL host variable in the File Section might lead to
incorrect output from SQL statements or abend 04E with RC=00E7000C.

Thanks in advance.
Donnie

Donald W. Woodruff, Jr.
Systems Programmer/DBA
City of Newport News
2400 Washington Ave, 2nd Floor--IT Dept
Newport News, VA 23607
[login to unmask email]




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002








James Campbell

Re: DSNH310I W Host Variable Declared in File Section
(in response to Neil Courtney)
Donnie,

If you add the statement
MOVE ZERO TO SQL-INIT-FLAG
immediately before _every_ sql statement that uses a host variable in
the file section you should (which doesn't mean you always will) be
OK. This does have the overhead of making the program re-resolve all
addresses in parameter lists for every such SQL statement.

This gets around the problem alluded to in other reponses where you
do this resolution once (when the program starts) but by the time the
host variable "address" is used, the host variable isn't there
anymore.

James Campbell

> -----Original Message-----
> From: Donnie Woodruff [mailto:[login to unmask email]
> Sent: Friday, December 27, 2002 8:42 AM
> To: [login to unmask email]
> Subject: DSNH310I W Host Variable Declared in File Section
>
>
> DB2L'ers:
>
> Happy Holidays!
>
> Recently a developer used a variable defined in the File Section as a Host
> Variable for a DB2 query. This may be a ridiculous question, but can
> someone tell me why DB2 might have a problem with it?
>
> For a DSNH310I message, the DB2 Messages & Codes manual states:
>
> If this host variable is used, the user assumes responsibility for possible
> exposure of incorrect output. Refer to Section 3 of DB2 Application
> Programming and SQL Guide to determine where host variables can be validly
> declared. Declaring a COBOL host variable in the File Section might lead to
> incorrect output from SQL statements or abend 04E with RC=00E7000C.
>
> Thanks in advance.
> Donnie
>
> Donald W. Woodruff, Jr.
> Systems Programmer/DBA
> City of Newport News
> 2400 Washington Ave, 2nd Floor--IT Dept
> Newport News, VA 23607
> [login to unmask email]
>
>
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system (http://www.grisoft.com).
> Version: 6.0.434 / Virus Database: 243 - Release Date: 12/25/2002
>
>
>
>
>
>
>
>