IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

GROUP BY in DFSORT - replace zeros in the current record


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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: 1702
Location: Australia

PostPosted: Thu Dec 22, 2011 8:16 am
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
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: 1702
Location: Australia

PostPosted: Fri Dec 23, 2011 3:34 am
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
Search our Forums:

Back to Top