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
 

 

can this be done using DFSORT

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

New User


Joined: 06 Jan 2008
Posts: 11
Location: India

PostPosted: Mon May 31, 2010 10:17 am    Post subject: can this be done using DFSORT
Reply with quote

Hi,

I have a requirement lik this.

I/P File:
Code:
F1  F2    F3    F4    F5   F6
B  100  100  150  200 
B  120  140  200  220  30
B  150  110  210  120  30
K  000  000  000  000  30
B  180  100  210  130  55
B  050  210  130  170  55
K  000  000  000  000  55

where
F1 => rec type
F2, F3, F4, F5 => Amount fields
F6 => State code

O/P File:

Code:
B  100  100  150  200 
B  120  140  200  220  30
B  150  110  210  120  30
K  270  250  410  340  30
B  180  100  210  130  55
B  050  210  130  170  55
K  230  310  340  300  55


When Record type "B" has same state code, then the amount values from the Fields F2, F3, F4 and F5 should be added and replaced in the K record.

can this be done using DFSORT?
Thanks for your help
Back to top
View user's profile Send private message

nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Mon May 31, 2010 10:48 am    Post subject:
Reply with quote

Hi,

First record with record type B in the input is not added in your output shown.
Code:
B  100  100  150  200
This means that if you don't have F6 in your input we should not add it in the output? Instead it should be a separate record.

Or provide us the rules to derive the output.

Provide LRECL and RECFM of your input and output file.
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Mon May 31, 2010 11:00 am    Post subject:
Reply with quote

Also Provide us the offset and length of each field.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 31, 2010 11:23 am    Post subject:
Reply with quote

What is LRECL\RECFM of the input and output files?
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 31, 2010 11:28 am    Post subject:
Reply with quote

nelson.pandian wrote:
This means that if you don't have F6 in your input we should not add it in the output? Instead it should be a separate record.

B records should be considered for addition only if it's State code matches with State code of K record...
Back to top
View user's profile Send private message
nelson.pandian

Active User


Joined: 09 Apr 2008
Posts: 133
Location: Phoenix, AZ

PostPosted: Mon May 31, 2010 12:28 pm    Post subject:
Reply with quote

Thanks Sambhaji for clearing my doubt. Now i got it icon_biggrin.gif
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Mon May 31, 2010 12:54 pm    Post subject:
Reply with quote

Deepa Natarajan

If order of B records within block is not a concern then below sortstep will give you desired result.

I have assumed RECFM=FB and LRECL=80
Code:

//S1    EXEC  PGM=SORT                                                 
//SYSOUT    DD  SYSOUT=*                                               
//SORTIN DD *                                                         
B  100  100  150  200                                                 
B  120  140  200  220  30                                             
B  150  110  210  120  30                                             
K  000  000  000  000  30                                             
B  180  100  210  130  55                                             
B  050  210  130  170  55                                             
K  000  000  000  000  55                                             
/*                                                                     
//SORTOUT DD SYSOUT=*                                                 
//SYSIN    DD    *                                                     
 INREC IFTHEN=(WHEN=GROUP,END=(1,1,CH,EQ,C'K'),PUSH=(81:ID=8,89:SEQ=8))
 SORT FIELDS=(81,8,ZD,A,89,8,ZD,D)                                     
 OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(1,1,CH,EQ,C'K'),PUSH=(97:24,2)),     
        IFTHEN=(WHEN=(24,2,CH,EQ,97,2,CH),OVERLAY=(99:4,18))           
 OUTFIL REMOVECC,OMIT=(1,1,CH,EQ,C'K'),                               
 SECTIONS=(81,8,                                                       
 TRAILER3=(1:C'K',4:TOT=(99,3,ZD,EDIT=(TTT)),2X,             
                    TOT=(104,3,ZD,EDIT=(TTT)),2X,           
                    TOT=(109,3,ZD,EDIT=(TTT)),2X,           
                    TOT=(114,3,ZD,EDIT=(TTT)),2X,97,2)),     
 BUILD=(1,80)                                               
/*   

Output will be:
Code:

B  150  110  210  120  30
B  120  140  200  220  30
B  100  100  150  200   
K  270  250  410  340  30
B  050  210  130  170  55
B  180  100  210  130  55
K  230  310  340  300  55


If you want output in the same order as input you need one more sortstep which can do so. Let us know if it suits your requirement...
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 How to get the remainder and quotient... vnktrrd DFSORT/ICETOOL 2 Mon Oct 31, 2016 10:59 am
No new posts Change date (DD/MM/YY) in 2nd record ... uday kiran DFSORT/ICETOOL 12 Wed Sep 07, 2016 10:57 pm
No new posts DFSORT sorting only specific records akodakka DFSORT/ICETOOL 4 Thu Aug 04, 2016 11:24 am
No new posts Symbolic Parameters in SYSIN DD state... madishpa DFSORT/ICETOOL 3 Mon Jun 27, 2016 6:23 pm
No new posts DFSORT to match two files and write John F Dutcher DFSORT/ICETOOL 6 Thu May 12, 2016 5:17 pm


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