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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to move specific records to the end of file using sort?
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 Moderator


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

PostPosted: Sat Nov 11, 2006 2:30 am    Post subject:
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    Post subject: sorry. Its typo..
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 Moderator


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

PostPosted: Sun Nov 12, 2006 12:11 am    Post subject:
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    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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm


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