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

How to move specific records to the end of file using sort?


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

New User


Joined: 19 Apr 2005
Posts: 11

PostPosted: Sat Nov 11, 2006 1:49 am
Reply with quote

Hi,
In my file, I have following records.

Code:

    123456ABCDTTT
    456870SDFSAYYY
    568791WLDISTTT
    253648AMWINZZZ
    483257IOKMSYYY


In the output file, I want all the records that has XXX in the last 3 bytes to appear at the end.

Code:

      456870SDFSAYYY
      253648AMWINZZZ
      483257IOKMSYYY
      123456ABCDTTT
      568791WLDISTTT


Note: other records can be of any order. Only the records with XXX should appear at the end of the file.

Pls let me know if this can be done using DFSORT.

Thanks,
Ranjini
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Sat Nov 11, 2006 2:30 am
Reply with quote

It's not clear what you want to do.

What is the RECFM and LRECL of your input file?

It your example, it looks like 'TTT' can start in different positions in different records. Is that the case, or does 'TTT' start in the same position in every record (which position?).

If 'TTT' can start in different positions in different records, then what do you mean by "TTT should appear at the end of the record" ( I assume you meant "record" here and not "file"). Do you mean 'TTT' should appear before a blank character, or something else? Please explain clearly what you mean by this. Does the first non-blank data byte (i.e. 1, 4, 5, 2, 4) start in the same position in every record? If so, which position?

Do you want the 'TTT' records at the end to appear in their original order or can they also appear in any order?
Back to top
View user's profile Send private message
RANJINI
Warnings : 1

New User


Joined: 19 Apr 2005
Posts: 11

PostPosted: Sat Nov 11, 2006 10:28 am
Reply with quote

It is a typo. all the TTT appears in 11th column of the file. All the records that have 'TTT' in 11th position should come in last in the file. With the TTT records, there can be any order.

First non-blank character starts @ position 1.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


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

PostPosted: Sun Nov 12, 2006 12:11 am
Reply with quote

Here's a DFSORT job that will do what you asked for. 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    *
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:C'A')),
        IFTHEN=(WHEN=(11,3,CH,EQ,C'TTT'),OVERLAY=(81:C'B'))
  SORT FIELDS=(81,1,CH,A)
  OUTREC BUILD=(1,80)
/*
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 Binary File format getting change whi... All Other Mainframe Topics 7
No new posts To fetch records that has Ttamp value... DFSORT/ICETOOL 4
No new posts ICETOOL returns no records JCL & VSAM 1
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
Search our Forums:

Back to Top