View previous topic :: View next topic
|
Author |
Message |
rkprasanth_m
New User
Joined: 22 Jun 2006 Posts: 44
|
|
|
|
I have a requirement that I need to skip headings(first 3 lines) while sorting a report.
Can we do like that using DFSORT control statements. |
|
Back to top |
|
|
rkprasanth_m
New User
Joined: 22 Jun 2006 Posts: 44
|
|
|
|
I mean those headings should be added to sortout file at the begining. Those heading lins should be excluded from sorting. |
|
Back to top |
|
|
Alain Benveniste
New User
Joined: 14 Feb 2005 Posts: 88
|
|
Back to top |
|
|
rkprasanth_m
New User
Joined: 22 Jun 2006 Posts: 44
|
|
|
|
Thanks Martin
I have checked given link. But I can't reformt my input file. I just wanted to skip header records from processing. Can't we copy first n records to output file by bypass sort processing..so the remaining records will go through sort processing? |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
That trick does what you want. It only reformats the records temporarily. The output file will not have the temporary fields.
If you need more help with this, show an example of your input records and what you want for output. And tell us the RECFM and LRECL of your input file. |
|
Back to top |
|
|
rkprasanth_m
New User
Joined: 22 Jun 2006 Posts: 44
|
|
|
|
Frank Yaeger,
Here a sample report file that I wanted to sort..
User-Id Voilation Sign Sent-Date Due-Date Final Revoke Revoke
Date Off EFlag Date EFlag
-----------------------------------------------------------------------------------
KPTMDFLT 10/19/2006 y 11/10/2006 11/24/2006 N N
ZKUEC2 10/19/2006 y 11/10/2006 11/24/2006 N N
ZKUEW2 10/19/2006 y 11/10/2006 11/24/2006 N N
ZKUJ52 10/19/2006 y 11/10/2006 11/24/2006 N N
ZKUMG7 10/19/2006 y 11/10/2006 11/24/2006 N N
ZKURL1 10/19/2006 N 11/10/2006 11/24/2006 N y
ZKUYN6 10/19/2006 N 11/10/2006 11/24/2006 N y
The requirement is the output file should contain headings as first 3 records then sorted records.
One more question, can I use same file name in sortin and sortout?
[/img] |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
A variation of the trick will work for that.
Again, what is the RECFM and LRECL of your input file?
What is the position, length and format of the field or fields you want to sort on?
Quote: |
can I use same file name in sortin and sortout? |
No. And that's usually not a good idea anyway since you could lose the file if something goes wrong. |
|
Back to top |
|
|
rkprasanth_m
New User
Joined: 22 Jun 2006 Posts: 44
|
|
|
|
Frank Yaeger
LRECL=133,RECFM=FB and input file has 3 heading lines. headings apper more then once. I don't have alter access to input file. What I really wanted is hide heading lines from sorting process, and output file should only have one set of headings at the begining. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Given what you've said, the easiest way to do this is to omit the header lines, sort the data and rebuild the first header lines, with a DFSORT job something like this:
Code: |
//S1 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=... input file (FB/133)
//SORTOUT DD DSN=... output file (FB/133)
//SYSIN DD *
OMIT COND=(1,7,CH,EQ,C'User-Id',OR,1,7,CH,EQ,C' ',
OR,1,7,CH,EQ,C'-------')
SORT FIELDS=(...)
OUTFIL HEADER1=(1:'User-Id',13:'Voilation',
29:'Sign',...,/,
13:'Date',29:'Off',...,/,
1:83'-')
/*
|
|
|
Back to top |
|
|
rkprasanth_m
New User
Joined: 22 Jun 2006 Posts: 44
|
|
|
|
Thanks.. Frank |
|
Back to top |
|
|
|