View previous topic :: View next topic
|
Author |
Message |
nmr
New User
Joined: 27 Sep 2007 Posts: 14 Location: hyderabad
|
|
|
|
hi all,
before posting i search in the forum i did not get proper answer so i am posting
Code: |
policy amount
6064 1000
6064 4000
6064 2000
6064 3000
6064 4000
6065 4000
6065 5000
6065 6000
-------
29000
--------
|
my requirement i want to calculate total from the amount field and need to send only total amount(29000) to another file
can any body give me an idea for this requirement |
|
Back to top |
|
|
krisprems
Active Member
Joined: 27 Nov 2006 Posts: 649 Location: India
|
|
|
|
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
6064 1000
6064 4000
6064 2000
6064 3000
6064 4000
6065 4000
6065 5000
6065 6000
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(TOT=(6,4,ZD,LENGTH=7))
/*
|
|
|
Back to top |
|
|
nmr
New User
Joined: 27 Sep 2007 Posts: 14 Location: hyderabad
|
|
|
|
hi krisprems
your giving code is working fine i am getting total amount in the output file
but the total i am geeting in the 4th position in the out put file, i want the amount field to start in 73 coloumn, how can we do this, you have any solution for this. |
|
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. I assumed your input file has RECFM=FB and LRECL=80 and that's what you want for the output file as well, but the job can be changed appropriately for other attributes. I also assumed you wanted a 5-byte total with leading zeros, but that can be changed if appropriate as well.
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
6064 1000
6064 4000
6064 2000
6064 3000
6064 4000
6065 4000
6065 5000
6065 6000
/*
//SORTOUT DD DSN=... output file (FB/80)
//SYSIN DD *
OPTION COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=(73:TOT=(17,4,ZD,EDIT=(TTTTT)))
/*
|
SORTOUT would have:
|
|
Back to top |
|
|
|