IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Null values are considered in Total calculation in ICETOOL ?


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
surezznag

New User


Joined: 04 Aug 2023
Posts: 6
Location: India

PostPosted: Fri Aug 04, 2023 3:35 pm
Reply with quote

I have requirement to calculate total count of records and Sum of comp-3 variable in flat file and it has to be done by JCL not by cobol. I coded sort card jcl where it will calculate in count and sum in trailer 1.

Now my question is does the Sum function automatically ignore null value appearing in numeric field while calculating or we need some exception handling.
Back to top
View user's profile Send private message
Joerg.Findeisen

Senior Member


Joined: 15 Aug 2015
Posts: 1337
Location: Bamberg, Germany

PostPosted: Fri Aug 04, 2023 4:31 pm
Reply with quote

Use CSF or FS as data format.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Sat Aug 05, 2023 8:26 pm
Reply with quote

surezznag wrote:
I have requirement to calculate total count of records and Sum of comp-3 variable in flat file and it has to be done by JCL not by cobol. I coded sort card jcl where it will calculate in count and sum in trailer 1.

Now my question is does the Sum function automatically ignore null value appearing in numeric field while calculating or we need some exception handling.

In case your data have been unloaded from DB2, the NULL values are indicated BY A SEPARATE FIELD associated with every nullable field of the unloaded table.

In case you have a non-DB2 related dataset, you MUST FIND OUT: how the NULL value is indicated in this home-made data? (May be any unacceptable value: a negative one, or invalid decimal packed, or 100 other options)

This is the first thing YOU MUST DO before posting your questions at this forum.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Mon Aug 07, 2023 2:37 am
Reply with quote

Or replace nulls to 0 in db2
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Mon Aug 07, 2023 4:33 am
Reply with quote

Rohit Umarjikar wrote:
Or replace nulls to 0 in db2

1. There was nothing about DB2 in the original post. We can only guess what TS meant…

2. From the very beginning NULLS were introduced for situations where replacing them with zero (or whatever else) may produce absolutely wrong results.

For example, the record PERSON may include field SALARY to keep the salary of the person if he is working at current time. Assigning value 0.00 as SALARY of those persons who are not working (e.g. children, disabled persons, retired persons, etc.) would produce incorrect results when trying to calculate AVERAGE, MIN, Number_of_employed, etc. Any other “invalid” value, like -1.00 would not resolve the problem. In many situations like this one using special NULL values is absolutely necessary.

Highly likely, the TS has not a minor idea about data architecture problems.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Mon Aug 07, 2023 9:49 am
Reply with quote

I don’t disagree but without converting to 0 it’s not goning to work .. I only suggested to fix the source ( most likely db2 only).

With your example TS can filter active employee only in Include cond than depending on nulls.

Anyways he can use DFSORT to convert nulls to 0 and do the calc.
Back to top
View user's profile Send private message
sergeyken

Senior Member


Joined: 29 Apr 2008
Posts: 2141
Location: USA

PostPosted: Mon Aug 07, 2023 5:56 pm
Reply with quote

Rohit Umarjikar wrote:
I don’t disagree but without converting to 0 it’s not goning to work .. I only suggested to fix the source ( most likely db2 only).

It's not going to work neither with conversion to zero, nor without it.

The issue with NULLS (if it is really from DB2 - but still under question) cannot be resolved by setting to zero.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts ICETOOL to SUM String DFSORT/ICETOOL 1
No new posts how to eliminate null indicator value... DB2 7
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
Search our Forums:

Back to Top