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

Sorting group data


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
rajella

New User


Joined: 22 Jan 2017
Posts: 2
Location: USA

PostPosted: Sun Jan 22, 2017 10:46 pm
Reply with quote

Hi,
Can someone help me in this or give me some useful hint to do this please. I am new to mainframe and to this forum as well.
I need to interchange only the specific records from the input file while copying it output file.
Say for example in the below input records, if the second field is same in the records (account number is same) and if the third filed has 016 and 015, then I need to interchange that record while copying to output file. All other records should be in the same order as input file.
Input Records:
HDR 01222017 INPUT
DTL ACTNO1 010 ABCDEFG
DTL ACTNO2 333 OPURSTV
DTL ACTNO2 211 PQRYUVS
DTL ACTNO3 O16 LSRYUVS
DTL ACTNO3 015 RSTUVSW

DTL ACTNO4 016 JKWMNTQ
DTL ACTNO5 015 IUNBVST
TRL 000009

Expected Records in the output file
HDR 01222017 INPUT
HDR 01222017 INPUT
DTL ACTNO1 010 ABCDEFG
DTL ACTNO2 333 OPURSTV
DTL ACTNO2 211 PQRYUVS
DTL ACTNO3 015 RSTUVSW
DTL ACTNO3 O16 LSRYUVS

DTL ACTNO4 016 JKWMNTQ
DTL ACTNO5 015 IUNBVST

Thanks
Prabakaran
Back to top
View user's profile Send private message
Pandora-Box

Moderator


Joined: 07 Sep 2006
Posts: 1565
Location: Andromeda Galaxy

PostPosted: Sun Jan 22, 2017 11:33 pm
Reply with quote

Always better to start new topic

Please show us what you have tried ?

Also what sort product do you use?
Back to top
View user's profile Send private message
rajella

New User


Joined: 22 Jan 2017
Posts: 2
Location: USA

PostPosted: Sun Jan 22, 2017 11:59 pm
Reply with quote

I know only the following options in sort utility.
SORT FIELDS = ()

SORT FIELDS=COPY
INCLUDE COND=()

SORT FIELDS=COPY
OUTFILE FILES=01,INCLUDE=( )

SORT FIELDS=COPY
SUM FIELDS=NONE,XSUM

SORT FIELDS = ()
SUM FIELDS = NONE

SORT FIELDS=COPY
INREC FIELDS= ()

JOINKEYS =()

Since by using the following we can’t do this, I didn’t tried anything on this. If you can give me some hints or keywords in the sort utility to do this, I will try this from there. Now I am not sure where to start on this.
Please help.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7311
Location: Inside the Matrix

PostPosted: Mon Jan 23, 2017 2:46 pm
Reply with quote

You will need to use INREC with IFTHEN=(WHEN=GROUP with BEGIN=(logicalexpression), RECORDS=2, identify the first record and to PUSH the entire record to a temporary extension to the current record.

Then you need OUTFIL with IFTHEN=(WHEN=((logicalexpression) to identify the second record, and to BUILD with the slash-operator (/) so that you output the second record as the first, followed by the first as the second. You will also need OMIT= on the OUTFIL to get rid of the, by then, redundant first record.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Mon Jan 23, 2017 9:24 pm
Reply with quote

Just curious - Will you always have the '016' and '015' records as the first 2 records in the ACTNO group, if at all they are present, or no?.
Also is there a chance of only one of these being present in the group and not the other?
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 compare two file to find position/dat... SYNCSORT 2
No new posts Secondary index error while loading d... IMS DB/DC 2
No new posts SKIP LOCKED DATA in UPDATE statement DB2 9
No new posts Hexadecimal Group compare and write t... DFSORT/ICETOOL 5
No new posts DB2 group member usage DB2 0
Search our Forums:

Back to Top