View previous topic :: View next topic |
Author |
Message |
priya173 Beginner
Joined: 04 May 2006 Posts: 10 Topics: 6 Location: India
|
Posted: Thu Feb 22, 2007 3:03 pm Post subject: Reformat the Edited Numeric field to implicit decimal format |
|
|
Hi,
I have a huge file (length 4939) with a lot of numeric fields in explicit decimal format. But since I need to perform few arithmetic operations on these fields, I would want to get them converted to the Implicit decimal format.
I tried the Fileaid reformat option but then it is not converting few fields in the occurs clause. Can someone help me with some utility to do it. I do not want to write a COBOL program for this.
Input fields:
-------------
Amt1 PIC 9(9).9(2)
Amt2 PIC 9(5).9(5)
Output fields:
---------------
Amt1 PIC 9(9)V9(2)
Amt2 PIC 9(5)V9(5) _________________ Regards,
Subha |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Feb 22, 2007 3:36 pm Post subject: |
|
|
Quote: |
But since I need to perform few arithmetic operations on these fields, I would want to get them converted to the Implicit decimal format.
|
priya173,
You can still perform Arthimetic operations with explicit decimal point within SORT using the UFF and SFF formats. Show us an sample input and desired output and we will show you a way to do it
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
priya173 Beginner
Joined: 04 May 2006 Posts: 10 Topics: 6 Location: India
|
Posted: Thu Feb 22, 2007 3:52 pm Post subject: Example for Reformat fields |
|
|
Input File
0000111.000111 0000222.000222
0000222.000222 0000333.000333
0000333.000333 0000444.000444
Output File
0000333.000333
0000555.000555
0000777.000777
All that I want to do is add the two fieds and write the sum in the output files. The output file amount could be in any format _________________ Regards,
Subha |
|
Back to top |
|
 |
Frank Yaeger Sort Forum Moderator

Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
|
Posted: Thu Feb 22, 2007 4:09 pm Post subject: |
|
|
Subha,
Here's a DFSORT job that will do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0000111.000111 0000222.000222
0000222.000222 0000333.000333
0000333.000333 0000444.000444
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
INREC BUILD=(1,14,UFF,ADD,16,14,UFF,
EDIT=(TTTTTTT.TTTTTT))
/*
|
_________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Thu Feb 22, 2007 4:09 pm Post subject: |
|
|
priya73,
try this
Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0000111.000111 0000222.000222
0000222.000222 0000333.000333
0000333.000333 0000444.000444
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC FIELDS=(01,14,UFF,ADD,16,14,UFF,
EDIT=(IIIIIIT.TTTTTT))
/*
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
priya173 Beginner
Joined: 04 May 2006 Posts: 10 Topics: 6 Location: India
|
Posted: Thu Feb 22, 2007 11:26 pm Post subject: |
|
|
Actually the example was a much simpler one in relaity I have to read 3 files and based on the value of the files I need to perform few arithmetic operations.
Like...
File1
Emp_Dep and Sal
File2
Emp_Id and Rating
Calculation
If Emp_Dep = 'INS" and Rating = '1' then
Hike = (Sal * 0.40 ) + Sal
There are 25 fields like this so we thought of converting the numeric fields and then using the output file.
Kindly let me know if this is possible. _________________ Regards,
Subha |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Fri Feb 23, 2007 7:47 am Post subject: |
|
|
priya173,
Why are you wasting time? Why can't you tell us the requirement properly at once ? Search the board for examples of matching files and apply the logic shown above for calculation
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
|
|