Code Comments
Programming Forum and web based access to our favorite programming groups.Hello: I need to move NULL or null value into a field in cobol. eg: I have a field called store-id PIC S99999V COMP-3. since I dont populate any value into it I need to move NULL into it. It shouldn't be zero. how do I do that in COBOL. please help RM -- posted via MFF : http://www.MainFrameForum.com - USENET Gateway
Post Follow-up to this messageOn Tue, 17 Aug 2004 21:58:09 GMT, aaryam <member@mainframeforum.com> wrote: >I need to move NULL or null value into a field in cobol. > >eg: I have a field called store-id PIC S99999V COMP-3. since I dont >populate any value into it I need to move NULL into it. It shouldn't be >zero. how do I do that in COBOL. > >please help Move low-values to the group name before you start moving or put a group name over the individual field, which is functionally the same as redefines, and move low-values to it. Caution: it is not common practice to put nulls in packed fields. On IBM mainframes, a reference to the numeric field name will cause an abend. Some non-mainframe compilers, for instance Micro Focus, also cause an abend unless a non-default runtime option is used. Why do you think you "need" to fill it with nulls?
Post Follow-up to this message> Hello > > I need to move NULL or null value into a field in cobol > > eg: I have a field called store-id PIC S99999V COMP-3. since I don > populate any value into it I need to move NULL into it. It shouldn't b > zero. how do I do that in COBOL > > please hel > posted via MFF : http://www.MainFrameForum.com - USENET Gateway Since you posted this from MainFrameForum I will assume you are on an IBM mainframe. Are you sure you know what you're doing? COMP-3 is PACKED-DECIMAL and I assume by nulls you mean binary zeros? Moving binary zeros would create an invalid packed field. Can you say S0C7? Anyway, here you go: 05 store-id pic S99999V comp-3. 05 store-id-x redefines store-id pic x(3). move low-values to store-id-x. Don't blame me for abends.
Post Follow-up to this message"aaryam" <member@mainframeforum.com> wrote in message news:RbvUc.22870$kC6.13105@cyclops.nntpserver.com... > Hello: > > I need to move NULL or null value into a field in cobol. > > eg: I have a field called store-id PIC S99999V COMP-3. since I dont > populate any value into it I need to move NULL into it. It shouldn't be > zero. how do I do that in COBOL. > > please help > > RM > > > > -- > posted via MFF : http://www.MainFrameForum.com - USENET Gateway Is this a DB2 program? ie, are you asking how to set a column to null via a host variable?
Post Follow-up to this messageaaryam wrote: > Hello: > > I need to move NULL or null value into a field in cobol. Trust me: No you don't. > > eg: I have a field called store-id PIC S99999V COMP-3. since I dont > populate any value into it I need to move NULL into it. It shouldn't > be zero. how do I do that in COBOL. "Store-id" An identifier? If an identifier it should never be defined as a numeric field (part numbers, zip codes, telephone or social security numbers, etc.). If you can't do arithmetic on the value, it's not a number and shouldn't be defined as one.
Post Follow-up to this messageHi RM, Null data fields usually don't appear in COBOL code unless the field is an address or a designated field in a DB2 table. If it's packed it can't be an address. Could this field be a DB2 table field? Regards, Jack. aaryam <member@mainframeforum.com> wrote in message news:<RbvUc.22870$kC6.13105@cyclops.nnt pserver.com>... > Hello: > > I need to move NULL or null value into a field in cobol. > > eg: I have a field called store-id PIC S99999V COMP-3. since I dont > populate any value into it I need to move NULL into it. It shouldn't be > zero. how do I do that in COBOL. > > please help > > RM
Post Follow-up to this messageOn Tue, 17 Aug 2004 18:53:46 -0500, "JerryMouse" <nospam@bisusa.com> wrote: > If you can't do arithmetic on the value, it's not a number >and shouldn't be defined as one. Well said. For this reason, dates are not numeric.
Post Follow-up to this message> > I need to move NULL or null value into a field in cobol. COBOL does not have a NULL value. You can have a numeric zero, or an alphanumeric string of binary zeroes or spaces, but there is no such thing as 01 FILLER 06 THE-DATA PIC anything VALUE IS NULL or MOVE NULL TO THE-DATA or SET THE-DATA TO NULL That said, external programs might _consider_ a value as NULL; e.g., a string of binary zeroes might be _interpreted_ as a null string by a 'C' language program; or (better example for COBOL programmers) setting a database indicator value to SQL_NULL tells a database manager that the data being supplied is to be considered NULL. MCM
Post Follow-up to this messageIBM Cobol, which this seems to be, does have a null value -- for Pointers. You can use: SET THE-DATA TO NULL as long as THE-DATA is defined as usage pointer. In article <R4HUc.1293$kd2.961@newssvr15.news.prodigy.com>, "Michael Mattias" <michael.mattias@gte.net> wrote: > > COBOL does not have a NULL value. > > You can have a numeric zero, or an alphanumeric string of binary zeroes or > spaces, but there is no such thing as > > 01 FILLER > 06 THE-DATA PIC anything VALUE IS NULL > > or > > MOVE NULL TO THE-DATA > or > SET THE-DATA TO NULL > > That said, external programs might _consider_ a value as NULL; e.g., a > string of binary zeroes might be _interpreted_ as a null string by a 'C' > language program; or (better example for COBOL programmers) setting a > database indicator value to SQL_NULL tells a database manager that the dat a > being supplied is to be considered NULL. > > MCM
Post Follow-up to this messageOn 17-Aug-2004, aaryam <member@mainframeforum.com> wrote: > Hello: > > I need to move NULL or null value into a field in cobol. > > eg: I have a field called store-id PIC S99999V COMP-3. since I dont > populate any value into it I need to move NULL into it. It shouldn't be > zero. how do I do that in COBOL. > > please help How does your subsequent program know that this COMP-3 field is null?
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.