I agree that is a likely to astonish but it is standard COBOL, no? No different 
than if you did MOVE 'GOODBYE' TO SOME-VAR. You'd end up with less than you 
might have expected.

Charles


-----Original Message-----
From: IBM Mainframe Discussion List [mailto:[email protected]] On Behalf 
Of John McKown
Sent: Wednesday, May 31, 2017 11:04 AM
To: [email protected]
Subject: Re: PIC Z is for zero suppression was Re: A slight regression

On Wed, May 31, 2017 at 12:41 PM, Farley, Peter x23353 < 
[email protected]> wrote:

> Apologies, the Z literal constant was indeed what I mis-remembered as 
> a PICTURE type.  The Z picture type is for zero-suppression of a 
> numeric field and has no relation to the Z literal constant.
>
> Sorry for my confusion.
>
> Peter
>

​It's easy to do. And I'm waiting for some COBOL programmer to ask why the 
following doesn't work:

77 SOME-VAR PIC X(5).

MOVE Z'HELL​O' TO SOME-VAR.
​
In COBOL 4.2, there is no error. Not even a warning (unless I've missed a 
compile option). But the trailing x'00' is quietly truncated. And so if the 
variable is passed to a C routine as a "char *", you are in a world of hurt.​

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to