Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Add 2 decimal fields - using EZT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CA Products
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    Post subject: Add 2 decimal fields - using EZT
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

Site Director


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

PostPosted: Sat Aug 02, 2008 2:24 am    Post subject:
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    Post subject: Reply to: Add 2 decimal fields - using EZT
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

Site Director


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

PostPosted: Sat Aug 02, 2008 10:21 pm    Post subject:
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: 2150
Location: At my coffee table

PostPosted: Sat Aug 02, 2008 10:58 pm    Post subject: Re: Add 2 decimal fields - using EZT
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    Post subject: Reply to: Add 2 decimal fields - using EZT
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

Site Director


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

PostPosted: Sun Aug 03, 2008 1:18 am    Post subject:
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    Post subject: Reply to: Add 2 decimal fields - using EZT
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

Site Director


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

PostPosted: Sun Aug 03, 2008 1:44 am    Post subject:
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    Post subject: Reply to: Add 2 decimal fields - using EZT
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

Site Director


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

PostPosted: Sun Aug 03, 2008 2:05 am    Post subject:
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    Post subject: Reply to: Add 2 decimal fields - using EZT
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

Site Director


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

PostPosted: Sun Aug 03, 2008 2:38 am    Post subject:
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    IBMMAINFRAMES.com Support Forums -> CA Products All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Sum Fields ballaswaroop DFSORT/ICETOOL 4 Tue May 02, 2017 11:07 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm
No new posts Joinkeys with decimal scdinesh DFSORT/ICETOOL 3 Fri Feb 10, 2017 4:46 am
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us