Re: Pro*cobol Spurious nulls being updated into database

From: Mark D Powell <Mark.Powell2_at_hp.com>
Date: Sat, 9 Jan 2010 12:47:59 -0800 (PST)
Message-ID: <7e7e1966-03e1-46bf-b2d5-535caa567f24_at_m25g2000yqc.googlegroups.com>



On Jan 8, 5:33 pm, "Steve Rainbird"
<steve.nospam.rainb..._at_mssint.nospam.com> wrote:
> "ddf" <orat..._at_msn.com> wrote in message
>
> news:6a0439b7-705d-4427-b78c-52e487660c7e_at_r24g2000yqd.googlegroups.com...
>
>
>
>
>
> > On Jan 8, 4:04 pm, "Steve Rainbird"
> > <steve.nospam.rainb..._at_mssint.nospam.com> wrote:
> >> I have a strange issue which I will probably report as a bug but thought
> >> i
> >> would pass by you guys 1st.
>
> >> I have an update statement
>
> >> EXEC SQL UPDATE HARDVER SET
> >> HAR_IMEPRT=NVL(RTRIM(:HAR-IMEPRT),' ')
> >> ,HAR_IMETER=NVL(RTRIM(:HAR-IMETER),' ')
> >> ,HAR_WINDOW=NVL(RTRIM(:HAR-WINDOW),' ')
> >> ,HAR_TIPTER=NVL(RTRIM(:HAR-TIPTER),' ')
> >> ,HAR_TIPPRT=NVL(RTRIM(:HAR-TIPPRT),' ')
> >> ,HAR_CEKPRT=NVL(RTRIM(:HAR-CEKPRT),' ')
> >> ,HAR_MJESTO=NVL(RTRIM(:HAR-MJESTO),' ')
> >> ,HAR_TELBRO=NVL(RTRIM(:HAR-TELBRO),' ')
> >> ,HAR_PORUKA=NVL(RTRIM(:HAR-PORUKA),' ')
> >> ,HAR_POSJED=:HAR-POSJED
> >> ,HAR_KESBOY=:HAR-KESBOY
> >> ,HAR_AMBROJ=:HAR-AMBROJ
> >> ,HAR_PMBROJ=:HAR-PMBROJ
> >> ,HAR_STATUS=:HAR-STATUS
> >> ,HAR_REDBRO=:HAR-REDBRO
> >> ,HAR_UPDATE=:HAR-UPDATE
> >> ,HAR_SATMIN=:HAR-SATMIN
> >> ,HAR_TELLER=:HAR-TELLER
> >> ,HAR_CEKOVI=:HAR-CEKOVI
> >> ,HAR_PRTOFF=:HAR-PRTOFF
> >> WHERE ROWID=:HARDVER-ROWID
> >> END-EXEC
>
> >> All of the host variables have values in them.
>
> >> For some reason HAR_PMBROJ is being updated with a null even thougth
> >> HAR-PMBROJ contains 84.
>
> >> If I comment out one of the assignments above HAR_PMBROJ then HAR_PMBROJ
> >> is
> >> ok but the next column in the update statement HAR_STATUS gets a null. If
> >> I
> >> comment out 2 of the assignments above HAR_PMBROJ then HAR_REDBRO gets a
> >> null.
>
> >> This is very strange and I have no idea why it is happening.
>
> >> TIA
>
> >> --
> >> Steve
>
> > What is the total length of all of these variables?  Have you exceeded
> > the line length restriction in COBOL or for Pro*COBOL?  Since this
> > NULL 'walks' the variable list as you comment out preceeding entries
> > it might be a bug that's reading the line terminator as a value.
>
> > All pure speculation, to be honest.
>
> > David Fitzjarrell
>
> This is the definition of the variables.
>
>              07 HAR-IMEPRT                     PIC X(20).
>              07 HAR-IMETER                     PIC X(20).
>              07 HAR-WINDOW                     PIC X(20).
>              07 HAR-TIPTER                     PIC X(10).
>              07 HAR-TIPPRT                     PIC X(10).
>              07 HAR-CEKPRT                     PIC X(20).
>              07 HAR-MJESTO                     PIC X(15).
>              07 HAR-TELBRO                     PIC X(10).
>              07 HAR-PORUKA                     PIC X(6).
>              07 HAR-POSJED                     PIC 9(3).
>              07 HAR-KESBOY                     PIC 9(6).
>              07 HAR-AMBROJ                     PIC 9(2).
>              07 HAR-PMBROJ                     PIC 9(2).
>              07 HAR-STATUS                     PIC 9(1).
>              07 HAR-REDBRO                     PIC 9(8).
>              07 HAR-UPDATE                     PIC 9(8).
>              07 HAR-SATMIN                     PIC 9(8).
>              07 HAR-TELLER                     PIC 9(1).
>              07 HAR-CEKOVI                     PIC 9(1).
>              07 HAR-PRTOFF                     PIC 9(1).
>
> Steve
>
> I
>
> --
> Steve- Hide quoted text -
>
> - Show quoted text -

If I remember my COBOL, Pic 9(2) is numeric character, that is, the character format of a numeric digit: 0 - 9. Is the raw values signed or over-punched by any chance. If so PIC S9(02) should fix the issue.

Does your code use null indicator bytes? Are these set correctly. I have never coded pro*COBOL but in pro*C you have to set the length bytes in the corresponding Oracle structure for variable character columns. If this needs to be done in COBOL were the corresponding length bytes for the first few character fields set correctly.

HTH -- Mark D Powell -- Received on Sat Jan 09 2010 - 14:47:59 CST

Original text of this message