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

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

Reply via email to