Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Sorting group data

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Sorting only specific records from the flat file
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: 1544
Location: Andromeda Galaxy

PostPosted: Sun Jan 22, 2017 11:33 pm    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7314

PostPosted: Mon Jan 23, 2017 2:46 pm    Post subject: Reply to: Sorting group data
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: 2287
Location: @my desk

PostPosted: Mon Jan 23, 2017 9:24 pm    Post subject:
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    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 Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Fetching data from JHS as per the cur... arunsoods All Other Mainframe Topics 4 Wed Nov 22, 2017 1:54 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm
No new posts Increment number for every group of r... srajendran2 DFSORT/ICETOOL 7 Thu Nov 09, 2017 10:31 pm
No new posts Updating data from one file to other!!! Vignesh Sid SYNCSORT 1 Mon Nov 06, 2017 2:42 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us