On Tue, Sep 4, 2012 at 12:03 PM, Scott Ford <scott_j_f...@yahoo.com> wrote:
> I have had to move a string type field like a parameter to a field like > this, > > Jobn char[40]; > > memset(Jobn,'0',sizeof(Jobn)); > strcpy(Jobn,xxxxx); > Please post additional code and the precise contents of xxxxx. Please put the contents in hex format so it can be appropriately evaluated. That is to say if the ebcidic is SCOTT1, the hex would be x'E2C3D6E3E3F100'. There is insufficient information to provide an accurate answer. The memset shown above is not needed. strcpy copies to the dest from the source starting at the left most byte of the dest until a binary zero is encountered in the source field. The binary zero in the source field is copied to the destination field. This can (and does) cause buffer overflow if not properly managed. > > Otherwise strcmp fails, where xxxxx is the parameter string > > Scott ford > www.identityforge.com > > On Sep 4, 2012, at 1:05 PM, retired mainframer <retired-mainfra...@q.com> > wrote: > > > The construct > > char x[3] = "ABC"; > > will legally initialize an array of char without adding the '\0'. The > only > > restriction is that this is not a string. > > > > :>: -----Original Message----- > > :>: From: IBM Mainframe Discussion List [mailto:IBM-MAIN@LISTSERV.UA.EDU] > On > > :>: Behalf Of John Gilmore > > :>: Sent: Tuesday, September 04, 2012 9:02 AM > > :>: To: IBM-MAIN@LISTSERV.UA.EDU > > :>: Subject: Re: Strings (hijacked from: The IBM zEnterprise EC12 > > :>: announcment) > > :>: > > :>: If you construct an array by initializing it element by element you > > :>: get an array, one that is not nul-delimited or 'of conceptually > > :>: unlimited length', whatever that may mean. > > :>: > > :>: If you construct a string by initializing a character array with a > > :>: string, you get a nul-delimited string implemented under the > > :>: hood|bonnet as an array. > > > > ---------------------------------------------------------------------- > > For IBM-MAIN subscribe / signoff / archive access instructions, > > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > > ---------------------------------------------------------------------- > For IBM-MAIN subscribe / signoff / archive access instructions, > send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN > ---------------------------------------------------------------------- For IBM-MAIN subscribe / signoff / archive access instructions, send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN