Hi
I am sorting records based on the first field and also i need sum of third field.At a point of time i got some records in input as follows.
12345 20081210 4500
12345 spaces 1500
12345 20081010 2000
I need a output like this
12345 20081010 8000.
I need to get the non space minimum date and also sum for the last fields.can anyone help me to resolve this?
Thanks in advance..
Eliminating spaces in Date field
- Frank Yaeger
- Global moderator
- Posts: 1079
- Joined: Sat Jun 09, 2007 8:44 pm
- Skillset: DFSORT, ICETOOL, ICEGENER
- Referer: Search
- Contact:
Re: Eliminating spaces in Date field
Here's a DFSORT job that will do what you asked for. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.
SORTOUT would have:
Code: Select all
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
12345 20081210 4500
12345 1500
12345 20081010 2000
22345 20081210 4000
22345 1200
22345 20080905 3000
//SORTOUT DD DSN=... output file (FB/80)
//SYSIN DD *
INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:8,8)),
IFTHEN=(WHEN=(8,1,CH,EQ,C' '),OVERLAY=(81:8C'9'))
SORT FIELDS=(1,5,CH,A)
OUTFIL REMOVECC,NODETAIL,BUILD=(1,80),
SECTIONS=(1,5,
TRAILER3=(1,5,
8:MIN=(81,8,ZD,TO=ZD,LENGTH=8),
17:TOT=(18,4,ZD,M10,LENGTH=5)))
/*
SORTOUT would have:
Code: Select all
12345 20081010 8000
22345 20080905 8200
Frank Yaeger - DFSORT Development Team (IBM) - yaeger@us.ibm.com
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
=> DFSORT/MVS is on the Web at http://www.ibm.com/storage/dfsort
-
- Similar Topics
- Replies
- Views
- Last post
-
- 1
- 1784
-
by sergeyken
View the latest post
Fri Mar 26, 2021 11:59 pm
-
- 3
- 1501
-
by sergeyken
View the latest post
Sun Nov 29, 2020 6:47 am
-
- 2
- 1583
-
by sergeyken
View the latest post
Sun Jan 26, 2025 3:07 am
-
- 1
- 5673
-
by enrico-sorichetti
View the latest post
Fri Dec 10, 2021 5:23 pm
-
-
sort card to add zeros to varying alphanumeric field.
by longfall » Thu Mar 09, 2023 12:03 am » in DFSORT/ICETOOL/ICEGENER - 1
- 1830
-
by sergeyken
View the latest post
Thu Mar 09, 2023 2:04 am
-