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
 

 

Swapping records using SORT

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

New User


Joined: 21 Nov 2006
Posts: 48
Location: mumbai

PostPosted: Fri Oct 26, 2007 12:57 pm    Post subject: Swapping records using SORT
Reply with quote

Hi all,
My input file has records
Code:

Record-No Record-Id Record-Type
1               A             10
1               A             20
1               A             10
1               A             20
2               A             10
2               A             10
2               A             20
2               A             20
3               A             10
3               A             20
3               A             10
3               A             20
.
.
.


     


I want to swap the records for Record-No 2 and Record-Id=A,
so that Record-Type 20 should come after 10 , as shown for other Record-No

Code:

Record-No Record-Id Record-Type
1               A             10
1               A             20
1               A             10
1               A             20
2               A             10
2               A             20
2               A             10
2               A             20
3               A             10
3               A             20
3               A             10
3               A             20
.
.
.
Back to top
View user's profile Send private message

Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Fri Oct 26, 2007 11:01 pm    Post subject:
Reply with quote

I'm not sure I understand what you want to do. But if you just want to change the 2/A records to have 10, 20, 10, 20, ..., you can use a DFSORT job like this. I assumed your input file has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1    EXEC  PGM=ICEMAN
//SYSOUT    DD  SYSOUT=*
//SORTIN DD DSN=...  input file (FB/80)
//SORTOUT DD DSN=... output file (FB/80)
//SYSIN    DD    *
  OPTION COPY
  INREC IFOUTLEN=80,
    IFTHEN=(WHEN=(1,1,CH,EQ,C'2',AND,17,1,CH,EQ,C'A'),
      OVERLAY=(81:SEQNUM,1,ZD,START=0,INCR=5,
        31:81,1,CHANGE=(2,C'0',C'10',C'5',C'20')))
/*
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 Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


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