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
 

 

Extraction of a record from a file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Fri Jun 20, 2008 12:42 pm    Post subject: Extraction of a record from a file
Reply with quote

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
View user's profile Send private message

ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Fri Jun 20, 2008 1:22 pm    Post subject:
Reply with quote

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
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Fri Jun 20, 2008 1:24 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Fri Jun 20, 2008 1:31 pm    Post subject:
Reply with quote

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
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Fri Jun 20, 2008 1:49 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Fri Jun 20, 2008 2:28 pm    Post subject:
Reply with quote

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
View user's profile Send private message
swapnadeep.ganguly

Active User


Joined: 21 Mar 2007
Posts: 203
Location: India

PostPosted: Fri Jun 20, 2008 5:37 pm    Post subject:
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Jun 20, 2008 5:50 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Fri Jun 20, 2008 6:20 pm    Post subject:
Reply with quote

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
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Fri Jun 20, 2008 6:26 pm    Post subject:
Reply with quote

Above solution extracts total record for the specified values.
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: Fri Jun 20, 2008 8:44 pm    Post subject:
Reply with quote

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:

www.ibm.com/servers/storage/support/software/sort/mvs/srtmpub.html
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 Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 11 Tue May 16, 2017 2:20 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
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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