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

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

Clark Morris wrote:
> [Default] On 30 May 2017 12:35:46 -0700, in bit.listserv.ibm-main
> [email protected] (Farley, Peter x23353) wrote:
>>
>> COBOL does have PICTURE usage type "Z" for zero-terminated strings, so you 
>> don't have to use the STRING verb to construct constant strings with a 
>> zero-byte terminator to call C modules.  I haven't experimented with moving 
>> "normal" COBOL strings (PIC X) to a PIC Z variable, so I do not know if that 
>> would work properly.
>>     
> Picture type Z is for zero suppression so in a PIC ZZZZZ, if 00000 is
> moved to it the result is 5 blanks, if 01234 is moved the result is
> blank1234 and if 12345 is moved the result is 12345.  I don't know oof
> anyway to specify a zero terminated field.

I believe the reference is to the Z literal constant specification. I 
think it may be an IBM extension.

MOVE Z'NULL TERMED STRING' TO WS-STRING

Moves "NULL TERMED STRING*" (where * is a x'00' byte) to WS-STRING.

05 ANOTHER-NULL-TERM-STRING  PIC X(05) VALUE Z'NULL'.

Sets the storage to "NULL*'.

Alan
--

This message and any attachments are intended only for the use of the addressee 
and may contain information that is privileged and confidential. If the reader 
of the message is not the intended recipient or an authorized representative of 
the intended recipient, you are hereby notified that any dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please notify us immediately by e-mail and delete the message and any 
attachments from your system.

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

Reply via email to