View previous topic :: View next topic
|
Author |
Message |
varalakshmi.G
New User
Joined: 04 Jun 2007 Posts: 55 Location: Hyderabad
|
|
|
|
Hi All,
I have a requirement that I want to sum one filed of input file.
The field is declared as ZZ9.999.
Could you tell me how to sum this field.
Thanks in advance,
Lakshmi.G |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You need to supply more details. Show an example of your input records (relevant fields only) and the expected output records. Give the starting position, length and format of each relevant field. Give the RECFM and LRECL of the input file. |
|
Back to top |
|
|
varalakshmi.G
New User
Joined: 04 Jun 2007 Posts: 55 Location: Hyderabad
|
|
|
|
Hi Frank,
The RECFM and LRECL of input file is FB 150 respectively.
The filed(73-79) is declared as ZZ9.999.
Suppose if my input file is having data like
1-5 73-79
54771 23.789
54774 123.657
54771 98.001
Then my output should be
54771 121.789
54774 123.657
Thanks,
Lakshmi |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
You can use a DFSORT job like the following to do what you asked for:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file
//SORTOUT DD DSN=... output file
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
OUTFIL REMOVECC,NODETAIL,
SECTIONS=(1,5,
TRAILER3=(1,5,X,TOT=(73,7,UFF,EDIT=(IIIT.TTT))))
/*
|
For your example, SORTOUT will have:
Code: |
54771 121.790
54774 123.657
|
I assume you want 121.790 (23.789+98.001) rather than 121.789. |
|
Back to top |
|
|
varalakshmi.G
New User
Joined: 04 Jun 2007 Posts: 55 Location: Hyderabad
|
|
|
|
Hi Frank,
It is working.
Thanks for your help.
Thanks,
Lakshmi |
|
Back to top |
|
|
|