Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref

Author Message
gprerna

New User

Joined: 21 Mar 2007
Posts: 38
Location: US

Posted: Fri Aug 01, 2008 9:36 pm    Post subject: Add 2 decimal fields - using EZT

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!

dick scherrer

Site Director

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

 Posted: Sat Aug 02, 2008 2:24 am    Post subject: 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.
gprerna

New User

Joined: 21 Mar 2007
Posts: 38
Location: US

 Posted: Sat Aug 02, 2008 7:34 pm    Post subject: Reply to: Add 2 decimal fields - using EZT I think it will be a problem if there is any carry over from the values after decimal part.
dick scherrer

Site Director

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

 Posted: Sat Aug 02, 2008 10:21 pm    Post subject: 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".
CICS Guy

Senior Member

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

Posted: Sat Aug 02, 2008 10:58 pm    Post subject: Re: Add 2 decimal fields - using EZT

 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.......
gprerna

New User

Joined: 21 Mar 2007
Posts: 38
Location: US

Posted: Sat Aug 02, 2008 11:04 pm    Post subject: Reply to: Add 2 decimal fields - using EZT

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!
dick scherrer

Site Director

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

 Posted: Sun Aug 03, 2008 1:18 am    Post subject: 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. . . .
gprerna

New User

Joined: 21 Mar 2007
Posts: 38
Location: US

 Posted: Sun Aug 03, 2008 1:21 am    Post subject: Reply to: Add 2 decimal fields - using EZT i want to do it using EZT...not COBOL
dick scherrer

Site Director

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

 Posted: Sun Aug 03, 2008 1:44 am    Post subject: 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. . .
gprerna

New User

Joined: 21 Mar 2007
Posts: 38
Location: US

 Posted: Sun Aug 03, 2008 1:49 am    Post subject: Reply to: Add 2 decimal fields - using EZT I havent tried till now, but just thought that carry over might be a problem. I will try it once...thanks!
dick scherrer

Site Director

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

 Posted: Sun Aug 03, 2008 2:05 am    Post subject: Hello, As i mentioned earlier - carry over will not be a problem so long as it is done correctly 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
gprerna

New User

Joined: 21 Mar 2007
Posts: 38
Location: US

 Posted: Sun Aug 03, 2008 2:06 am    Post subject: Reply to: Add 2 decimal fields - using EZT ya sure...i will keep you posted
dick scherrer

Site Director

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

 Posted: Sun Aug 03, 2008 2:38 am    Post subject: 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.
 All times are GMT + 6 Hours
 Page 1 of 1

Search our Forum:

 Topic Author Forum Replies Posted Similar Topics Sort numeric fields with trailing spaces sancraig16 SYNCSORT 7 Tue Apr 03, 2018 1:21 am SORT 3 files,extract specific fields ... Kiransr DFSORT/ICETOOL 13 Fri Mar 23, 2018 10:54 am How to group and sum the decimal value sakrat DFSORT/ICETOOL 2 Tue Mar 06, 2018 9:13 pm Sum the fields in particular format f... sharana64 DFSORT/ICETOOL 9 Fri Jan 05, 2018 1:11 am SORT BUT RETAIN HIGHEST VALUE ON NON-... leondan22 DFSORT/ICETOOL 2 Thu Dec 14, 2017 8:13 pm

 © 2003-2017 IBM MAINFRAME Software Support Division
 Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us