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

Add 2 decimal fields - using EZT


IBM Mainframe Forums -> CA Products
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gprerna

New User


Joined: 21 Mar 2007
Posts: 38
Location: US

PostPosted: Fri Aug 01, 2008 9:36 pm
Reply with quote

I have the input file where avg time is extracted as:

Code:

00000000000000.0562
00000000000000.0685
00000000000000.0783
00000000000000.0558
00000000000000.0759
00000000000000.1567


starting at position 44. This field is defined as Decimal 18,4 in database when it was extracted.

I need to take a average for the values in this column. How will i need to define this field in the EZT? Can anyone please help?

Thanks!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sat Aug 02, 2008 2:24 am
Reply with quote

Hello,

One way is to defne this as separate fields and then create a numeric field from the 2 pieces. The numeric field can then be summed / averaged.
Back to top
View user's profile Send private message
gprerna

New User


Joined: 21 Mar 2007
Posts: 38
Location: US

PostPosted: Sat Aug 02, 2008 7:34 pm
Reply with quote

I think it will be a problem if there is any carry over from the values after decimal part.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sat Aug 02, 2008 10:21 pm
Reply with quote

Hello,

No, there won't if it is done properly. . .

You would combine the 2 pieces of each line into a single value with an implied decimal rather than the physical decimal currently in the data.

The re-constructed number would be 000000000000000562 with 4 implied decimal places (just like dollars and cents if this were a money field). In cobol, it would be 9(14)v9(4).

To repeat, there would be no problem with "carry over".
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Sat Aug 02, 2008 10:58 pm
Reply with quote

gprerna wrote:
This field is defined as Decimal 18,4 in database when it was extracted.
Or just extract it without editing in the decimal point.......
Back to top
View user's profile Send private message
gprerna

New User


Joined: 21 Mar 2007
Posts: 38
Location: US

PostPosted: Sat Aug 02, 2008 11:04 pm
Reply with quote

Yeah...thats what actually i wanted to do, but was unable to extract without a decimal point from Dbase.

I used the below code in my extract parm:

Code:

CHAR(COALESCE(AVE_TIME,0)),


But its extracting with a decimal point as shown above in the first post. Can you please suggest how to extract from Dbase in the below format?

Code:

000000000000000562
000000000000000685
000000000000000783
000000000000000783
000000000000000783


Thanks!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sun Aug 03, 2008 1:18 am
Reply with quote

Hello,

Do you really mean dbase? I've not seen dbase used for a long time.

You already have perfectly workable data. All you have to do is use it. . .

If you are unwilling to combine the 2 pieces with your code, you could always switch to cobol and use the numval funcation. . . .
Back to top
View user's profile Send private message
gprerna

New User


Joined: 21 Mar 2007
Posts: 38
Location: US

PostPosted: Sun Aug 03, 2008 1:21 am
Reply with quote

i want to do it using EZT...not COBOL icon_sad.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sun Aug 03, 2008 1:44 am
Reply with quote

Hello,

If you had combined the fields as i mentioned hours ago, you would have completed the code before now. . .

Is there a problem with defining the first "field" (before the decimal) as
FIRST-HALF 14 N 0 and the second "field" as SECOND-HALF 4 N 4?

Keep in mind that you control the code and can define things as you need them. Just because the true value is "a field" that is no reason that you cannot deal with it in pieces to do what you need. . .
Back to top
View user's profile Send private message
gprerna

New User


Joined: 21 Mar 2007
Posts: 38
Location: US

PostPosted: Sun Aug 03, 2008 1:49 am
Reply with quote

I havent tried till now, but just thought that carry over might be a problem. I will try it once...thanks!
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sun Aug 03, 2008 2:05 am
Reply with quote

Hello,

As i mentioned earlier - carry over will not be a problem so long as it is done correctly icon_wink.gif

After you get the code running and run a test, you might post that bit of the code back here if you'd like someone to review it with you icon_smile.gif
Back to top
View user's profile Send private message
gprerna

New User


Joined: 21 Mar 2007
Posts: 38
Location: US

PostPosted: Sun Aug 03, 2008 2:06 am
Reply with quote

ya sure...i will keep you posted icon_smile.gif
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19243
Location: Inside the Matrix

PostPosted: Sun Aug 03, 2008 2:38 am
Reply with quote

Someone will be here. . .

I forgot to mention earlier, when defining the first and second "halves" of the number, but sure to leave one byte for the "." between the halves. It is a filler for this code.
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 -> CA Products

 


Similar Topics
Topic Forum Replies
No new posts Help required to reset decimal points... DFSORT/ICETOOL 5
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts Pull data using date difference betwe... DB2 6
No new posts small int to zoned decimal conversion DFSORT/ICETOOL 3
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top