Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

GROUP BY in DFSORT - replace zeros in the current record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
pavankch

New User


Joined: 07 Aug 2009
Posts: 2
Location: Bangalore

PostPosted: Thu Dec 22, 2011 6:58 am    Post subject: GROUP BY in DFSORT - replace zeros in the current record
Reply with quote

Hi, I have the below requirement on SORT Card

My input file contains the Employee and the amount field, lets say
11111 2.0
22222 5.0
00000 3.0
33333 1.8
44444 2.6
00000 3.0
00000 5.5
55555 1.2

Some of the employee numbers are tagged as zeros in the input file, this file is sent to us from a third party system.
Now i need to find the records which are zeros and replace it with the non-zero employee number picking from the prior record.
My output should be like,
11111 2.0
22222 5.0
22222 3.0
33333 1.8
44444 2.6
44444 3.0
44444 5.5
55555 1.2

Can anyone help me with this requirement..
Back to top
View user's profile Send private message

gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Thu Dec 22, 2011 8:16 am    Post subject:
Reply with quote

Hi,

try this
Code:
//STEP0001 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD *                                                         
11111 2.0                                                               
22222 5.0                                                               
00000 3.0                                                               
33333 1.8                                                               
44444 2.6                                                               
00000 3.0                                                               
00000 5.5                                                               
55555 1.2                                                               
/*                                                                     
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  OPTION COPY                                                           
  INREC  IFTHEN=(WHEN=GROUP,BEGIN=(1,5,ZD,GT,+0),                       
            PUSH=(1,5))                                                 
/*                                                                     



Gerry
Back to top
View user's profile Send private message
pavankch

New User


Joined: 07 Aug 2009
Posts: 2
Location: Bangalore

PostPosted: Thu Dec 22, 2011 8:44 am    Post subject:
Reply with quote

Wow.. Thanks much Gerry.. This worked..
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1703
Location: Australia

PostPosted: Fri Dec 23, 2011 3:34 am    Post subject:
Reply with quote

Hi,

I finally got to test a GROUP function.

z/OS 1.11 was installed and the updated DFSORT came with it.


Gerry icon_biggrin.gif
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Sorting group data rajella DFSORT/ICETOOL 3 Sun Jan 22, 2017 11:32 pm
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts abend sort based on count records in ... anatol DFSORT/ICETOOL 5 Mon Oct 17, 2016 10:10 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us