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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm


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