Re: PRO COBOL WITH VARCHAR FIELD TYPE

From: Scott Kronheim <skronheim_at_synertechsystems.com>
Date: Fri, 20 Aug 1999 12:44:02 -0400
Message-ID: <37BD85D2.93C8EE94_at_synertechsystems.com>


Lou de Freitas wrote:
>
> For example:
>
> MOVE AJL-BFR-IMAGE-LEN TO WS-DISP-CNT.
> DISPLAY 'BEFORE LEN IS ' WS-DISP-CNT.
> DISPLAY 'BEFORE DATA ' AJL-BFR-IMAGE-ARR.
> AM I CORRECT? I AM USING MICROSFOCUS COBOL UNDER 95, NT and UNIX and I
> think this is correct?

You are correct, with one caveat. My experience with Oracle has shown that fetches into the COBOL -ARR variable will only fill the number of positions specified in the -LEN variable and leave the rest as is.

More specifically, if the first value fetched is "HELLO WORLD", AJL-BFR-IMAGE-ARR will contain "HELLO WORLD" followed by whatever the field was originally initialized to. If the second value fetched is "GOODBYE", AJL-BFR-IMAGE-ARR will contain "GOODBYEORLD" followed by whatever the field was originally initialized to. In this case, assuming AJL-BFR-IMAGE-ARR was initialized to SPACES, the output of your example code would be:

   BEFORE LEN IS 11
   BEFORE DATA HELLO WORLD
   BEFORE LEN IS 7
   BEFORE DATA GOODBYEORLD The point to all this is that to get only the fetched value and nothing else, your last line of example code should read:

   DISPLAY 'BEFORE DATA ' AJL-BFR-IMAGE-ARR(1:WS-DISP-CNT). Hope that helps! Received on Fri Aug 20 1999 - 18:44:02 CEST

Original text of this message