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 Profile Log in to check your private messages Log in
 
How to Move the particular records to top of the file

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

New User


Joined: 31 Aug 2009
Posts: 6
Location: India

PostPosted: Fri Jan 21, 2011 12:27 pm    Post subject: How to Move the particular records to top of the file
Reply with quote

Hi I have the PS file which will have following records.

The Input file and out file is FB with size of 400.

Input File:

010 XXXXXx
020 xxxxxx
030 xxxxxx
199 xxxxxx
200 xxxxxx
209 xxxxxx
210 xxxxxx
219 xxxxxx
299 xxxxxx
300 xxxxxx
309 xxxxxx
310 xxxxxx
319 xxxxxx
399 xxxxxx
400 yyyyyy
400 yyyyyy
010 XXXXXx
020 xxxxxx
030 xxxxxx
199 xxxxxx
200 xxxxxx
209 xxxxxx
210 xxxxxx
219 xxxxxx
299 xxxxxx
300 xxxxxx
309 xxxxxx
310 xxxxxx
319 xxxxxx
399 xxxxxx
400 yyyyyy
400 yyyyyy
010 XXXXXx
020 xxxxxx
030 xxxxxx
199 xxxxxx
200 xxxxxx
209 xxxxxx
210 xxxxxx
219 xxxxxx
299 xxxxxx
300 xxxxxx
309 xxxxxx
310 xxxxxx
319 xxxxxx
399 xxxxxx
400 yyyyyy
400 yyyyyy
499 yyyyyy

The OutPut should be has follows,
OutPut File:

400 yyyyyy
400 yyyyyy
400 yyyyyy
400 yyyyyy
400 yyyyyy
400 yyyyyy
499 yyyyyy
010 XXXXXx
020 xxxxxx
030 xxxxxx
199 xxxxxx
200 xxxxxx
209 xxxxxx
210 xxxxxx
219 xxxxxx
299 xxxxxx
300 xxxxxx
309 xxxxxx
310 xxxxxx
319 xxxxxx
399 xxxxxx
010 XXXXXx
020 xxxxxx
030 xxxxxx
199 xxxxxx
200 xxxxxx
209 xxxxxx
210 xxxxxx
219 xxxxxx
299 xxxxxx
300 xxxxxx
309 xxxxxx
310 xxxxxx
319 xxxxxx
399 xxxxxx
010 XXXXXx
020 xxxxxx
030 xxxxxx
199 xxxxxx
200 xxxxxx
209 xxxxxx
210 xxxxxx
219 xxxxxx
299 xxxxxx
300 xxxxxx
309 xxxxxx
310 xxxxxx
319 xxxxxx
399 xxxxxx


The records starting with 400 and 499 only has to be moved to top of the file without rearraging other records.

Each 010 to 399 starting records are set.

The sort should be perform only on first three characters EX 010, 400.


Thanks in Advance..
Back to top
View user's profile Send private message

Guest







PostPosted: Fri Jan 21, 2011 2:04 pm    Post subject:
Reply with quote

Hi,
According to my understanding of your requirement the following Sort step will give the desired result:
Code:

//STEP0100 EXEC PGM=SORT       
//SYSOUT   DD SYSOUT=*         
//SORTIN   DD *               
010 XXXXXX                     
020 XXXXXX                     
030 XXXXXX                     
199 XXXXXX                     
200 XXXXXX                     
209 XXXXXX                     
210 XXXXXX                     
219 XXXXXX                     
299 XXXXXX                     
300 XXXXXX                     
309 XXXXXX
310 XXXXXX
319 XXXXXX
399 XXXXXX
400 YYYYYY
400 YYYYYY
010 XXXXXX
020 XXXXXX
030 XXXXXX
199 XXXXXX
200 XXXXXX
209 XXXXXX
210 XXXXXX
219 XXXXXX
299 XXXXXX
300 XXXXXX
309 XXXXXX
310 XXXXXX
319 XXXXXX
399 XXXXXX
400 YYYYYY
400 YYYYYY
010 XXXXXX
020 XXXXXX
030 XXXXXX
199 XXXXXX
200 XXXXXX
209 XXXXXX
210 XXXXXX
219 XXXXXX
299 XXXXXX
300 XXXXXX
309 XXXXXX
310 XXXXXX
319 XXXXXX
399 XXXXXX
400 YYYYYY                                               
400 YYYYYY                                               
499 YYYYYY                                               
//SORTOUT  DD SYSOUT=*                                   
//SYSIN    DD *                                           
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(21:SEQNUM,2,ZD)),       
       IFTHEN=(WHEN=INIT,OVERLAY=(20:C'9')),             
       IFTHEN=(WHEN=(1,3,CH,EQ,C'400'),OVERLAY=(20:C'1')),
       IFTHEN=(WHEN=(1,3,CH,EQ,C'499'),OVERLAY=(20:C'2'))
 SORT FIELDS=(20,1,CH,A,21,2,CH,A)                       
 OUTREC BUILD=(1,23)                                     
/*                                                       


You can modify the above according to the data in your file.

Devil13
There is always a better solution.
Back to top
Frank Yaeger

DFSORT Moderator


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

PostPosted: Sat Jan 22, 2011 12:37 am    Post subject:
Reply with quote

devil13,

You're on the right track, but your solution is more complicated than it needs to be. This simpler DFSORT job would do the trick.

Code:

//S1 EXEC PGM=SORT                           
//SYSOUT DD SYSOUT=*                         
//SORTIN DD DSN=...  input file (FB/400)         
//SORTOUT DD DSN=...  output file (FB/400)   
//SYSIN DD *                                 
   OPTION EQUALS                                               
   INREC IFTHEN=(WHEN=(1,3,SS,EQ,C'400,499'),OVERLAY=(401:Z)) 
   SORT FIELDS=(401,1,BI,A,1,3,CH,A)                           
   OUTREC BUILD=(1,400)                           
/*             
Back to top
View user's profile Send private message
Guest







PostPosted: Sun Jan 23, 2011 10:45 am    Post subject:
Reply with quote

Hi Frank,
I have always been learning from you. This is definitely a new learning.
Thanks a lot.

devil13
There is always a better solution.
Back to top
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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 21 Sun Aug 27, 2017 10:35 pm
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm

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