Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

how do I move NULL into a field ?
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

Report this thread to moderator Post Follow-up to this message
Old Post
aaryam
08-18-04 01:55 AM


Re: how do I move NULL into a field ?
On 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?



Report this thread to moderator Post Follow-up to this message
Old Post
Robert Wagner
08-18-04 01:55 AM


Re: how do I move NULL into a field ?
> 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.




Report this thread to moderator Post Follow-up to this message
Old Post
Mike
08-18-04 01:55 AM


Re: how do I move NULL into a field ?
"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?



Report this thread to moderator Post Follow-up to this message
Old Post
Don Leahy
08-18-04 01:55 AM


Re: how do I move NULL into a field ?
aaryam 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.



Report this thread to moderator Post Follow-up to this message
Old Post
JerryMouse
08-18-04 01:55 AM


Re: how do I move NULL into a field ?
Hi 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

Report this thread to moderator Post Follow-up to this message
Old Post
Jack Sleight
08-18-04 08:55 AM


Re: how do I move NULL into a field ?
On 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.


Report this thread to moderator Post Follow-up to this message
Old Post
Robert Wagner
08-18-04 08:55 AM


Re: how do I move NULL into a field ?
> > 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













Report this thread to moderator Post Follow-up to this message
Old Post
Michael Mattias
08-18-04 01:55 PM


Re: how do I move NULL into a field ?
IBM 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


Report this thread to moderator Post Follow-up to this message
Old Post
Joe Zitzelberger
08-18-04 08:55 PM


Re: how do I move NULL into a field ?
On 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?

Report this thread to moderator Post Follow-up to this message
Old Post
Howard Brazee
08-18-04 08:55 PM


Sponsored Links




Last Thread Next Thread Next
Pages (7): [1] 2 3 4 5 6 » ... Last »
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:46 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.