View previous topic :: View next topic
|
Author |
Message |
RANJINI Warnings : 1 New User
Joined: 19 Apr 2005 Posts: 11
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
RANJINI Warnings : 1 New User
Joined: 19 Apr 2005 Posts: 11
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|