View previous topic :: View next topic
|
Author |
Message |
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Hi,
We are required to extract some records (say 200) from a list of files for a particular month. These records are not related to one another except that they are for that particular month. |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Hi,
If I understood correctly your question, concatenate all the files and extract required number of records using SORT.
E.g., 1. If you want to extract 1st 200 records, you can provide in control card OPTION COPY,STOPAFT=200.
2. If you want to extrct last 200 records, SKIP all the records except last 200. If you have 1000 records and want to select last 200 records, provide option OPTION COPY,SKIP=800.
KSK |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
The files are neither first 200 or the last 200.
Actually the records are hapazardly located in the file. Now in this scenario can we extract them? |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
If you want records which are in between you can use the combination of SKIPREC and STOPAFT.
E.g., if you want records from 300 to 500 from a particular file, provide the following option.
OPTION COPY,SKIPREC=300,STOPAFT=200. This would copy 300 to 500 records from the file.(Above I have mentioned SKIP, it is not only SKIP but SKIPREC).
If you have some other requirement, show us with Input and output.
KSK |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
Let us assume the input to be
111111AAAAAAA10920190ADSJFADJFAJ54544
222222BBBBBBB54466461ASDKNCKKS54616
333333CCCCCCC10920190ADSJFADJFAJ54544
444444DDDDDDD54466461ASDKNCKKS54616
555555EEEEEEE10920190ADSJFADJFAJ54544
666666FFFFFFF54466461ASDKNCKKS54616
777777GGGGGGG10920190ADSJFADJFAJ54544
888888HHHHHHH54466461ASDKNCKKS54616
999999IIIIIII54466461ASDKNCKKS54616
We require the output as:
333333CCCCCCC10920190ADSJFADJFAJ54544
555555EEEEEEE10920190ADSJFADJFAJ54544
777777GGGGGGG10920190ADSJFADJFAJ54544
999999IIIIIII54466461ASDKNCKKS54616 |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
If you want to extract every 10th record or like that you can use SAMPLE option. In the example you have shown what is the creteria to extract the records? |
|
Back to top |
|
|
swapnadeep.ganguly
Active User
Joined: 21 Mar 2007 Posts: 203 Location: India
|
|
|
|
The criteria is we have a fixed column position for the fields (say EEEEEEE). This field length is constant. We are provided a list of this variables. We are to extract these variables from the files and then write the same in one single file. |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
swapnadeep.ganguly wrote: |
The criteria is we have a fixed column position for the fields (say EEEEEEE). This field length is constant. We are provided a list of this variables. We are to extract these variables from the files and then write the same in one single file. |
If you would clearly explain the criteria for extracting the records, provide the RECFM and LRECL and sample input and expected output then we could provide you with suggestion without guessing at what you want. It sounds like you want a simple INCLUDE but that is just a guess. |
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Using INCLUDE option we can acheive this. I am assuming your field (EEEEEEE) is of length '7' and starting at 7th position.
and I am assuming you have been provided AAAAAAA,BBBBBBB and 'EEEEEEE'
Code: |
OPTION COPY
INCLUDE COND=(7,7,CH,EQ,C'AAAAAAA',
OR,7,7,CH,EQ,C'BBBBBBB',OR,7,7,CH,EQ,C'EEEEEEE')
|
|
|
Back to top |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Above solution extracts total record for the specified values. |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Swapnadeep Ganguly,
If that's what you want to do, then alternatively you can use these DFSORT control statements:
Code: |
OPTION COPY
INCLUDE COND=(7,7,SS,EQ,C'AAAAAAA,BBBBBBB,EEEEEEE')
|
In the future, please try to explain the "rules" for what you're trying to do more clearly with examples.
If you're not familiar with DFSORT and DFSORT's ICETOOL, I'd suggest reading through "z/OS DFSORT: Getting Started". It's an excellent tutorial, with lots of examples, that will show you how to use DFSORT, DFSORT's ICETOOL and DFSORT Symbols. You can access it online, along with all of the other DFSORT books, from:
Use [URL] BBCode for External Links |
|
Back to top |
|
|
|