Being weird, I thought it would be "fun" to write a UNIX program in COBOL. I found an error in the example UNIX program in the COBOL programming guide. So I sent in an RCF and then decided to share it here as well.
---------- Forwarded message ---------- From: McKown, John <[email protected]> Date: Mon, Jan 29, 2018 at 11:47 AM Subject: RCF for "Enterprise COBOL for z/OS Programming Guide version 6.2" SC27-8714-01 To: "[email protected]" <[email protected]> Cc: "[email protected]" <[email protected]> There is an example on the web page: https://www.ibm.com/support/ knowledgecenter/en/SS6SG3_6.2.0/com.ibm.cobol62.ent.doc/ PGandLR/ref/rpenv15e.html (page 481 in the PDF), which goes back all the way to COBOL 4.2 I think that the example program has a slight error in it. The line: Display "Arg " curr-arg-count " = " arg (1:arg-length) Should be: Display "Arg " curr-arg-count " = " arg (1:arg-length - 1 ) Because the lengths of the arguments presented to the COBOL program in “arg-length-list” array include the terminating 0x00 C language string delimiter. In the example this is not really relevant. But I think that it might be if the data were written to a UNIX file, z/OS data set, or a database. Especially if the “string” were to have more characters appended to the end of it and using this, incorrect, value length value. That would result in a data item with an embedded 0x00, which if passed to a C routine would prematurely terminate the string value. -- *John McKown* System Engineer IV *HealthMarkets, Inc. * 9151 Boulevard 26 ■ North Richland Hills, TX 76180 <https://maps.google.com/?q=9151+Boulevard+26+%E2%96%A0+North+Richland+Hills,+TX+76180&entry=gmail&source=g> P (817) 255-3225 ■ ■ F (817) 255-8184 [email protected] ■ www.HealthMarketsInc.com *Confidentiality Notice: *This email message may contain confidential or proprietary information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. HealthMarkets, Inc. is a holding company that includes insurance subsidiaries The Chesapeake Life Insurance Company® and Mid-West National Life Insurance Company of TennesseeSM, and a subsidiary distribution company HealthMarkets Insurance Agency, Inc. -- I have a theory that it's impossible to prove anything, but I can't prove it. Maranatha! <>< John McKown ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to [email protected] with the message: INFO IBM-MAIN
