Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Extract n number of records from KEY value.

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

New User


Joined: 17 Feb 2007
Posts: 52
Location: USA

PostPosted: Tue Dec 01, 2009 8:03 am    Post subject: Extract n number of records from KEY value.
Reply with quote

Hi,

I need to extract records from a file. I need n records from Key value. The Key starts at position 2 , 10 bytes.

For example if KEY is ABCD123456 which is 10 bytes Character, I need next 50000 records starting from this KEY. I tried with INCLUDE COND but it is no use. It only extracts 1 record in output file. I tried with OPTION STOPAFT=50000 but do not know how/where to specify the starting Key value.

Thanks
Back to top
View user's profile Send private message

notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Tue Dec 01, 2009 9:30 am    Post subject:
Reply with quote

Is your key is in sorted order?

If so, try giving GT your key and stopaft 50000

Regards
Tanden
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Dec 01, 2009 1:54 pm    Post subject:
Reply with quote

Assuming your input dataset LRECL is 80
Below is sortstep to give desired result.
Code:

//S1    EXEC  PGM=SORT       
//SORTIN DD DSN=yourinutdatasethere
//SORTOUT DD DSN=youroutputdatasethere                           
//SYSOUT    DD  SYSOUT=*                         
//SYSIN    DD  *                                 
  OPTION COPY                                                           
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,10,CH,EQ,C'ABCD123456'),           
               PUSH=(81:SEQ=8))                                         
  OUTFIL INCLUDE=(81,8,ZD,GE,1,AND,81,8,ZD,LE,50000)                       
/*                                                                     
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: Tue Dec 01, 2009 9:48 pm    Post subject:
Reply with quote

Sambhaji,

Note that you are also assuming that there is only one ABCD123456 record in the file. Because a second ABCD123456 record would start a new group with a sequence number of 1, e.g.

ABCD123456 1
ABCD123457 2
ABCD123458 3
ABCD123456 1 <- seqnum starts at 1 again

If there is only one ABCD123456 record, then this would be simpler:

Code:

  OPTION COPY                                                 
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(2,10,CH,EQ,C'ABCD123456'),   
    RECORDS=50000,PUSH=(81:ID=1))                             
  OUTFIL INCLUDE=(81,1,CH,NE,C' '),                           
    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 sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm
No new posts Addition of two records on 2 fields amar143 SYNCSORT 8 Tue Oct 03, 2017 11:14 am
No new posts Spool Extract for Z /os 1.04 version Khadhar Basha CLIST & REXX 3 Thu Sep 28, 2017 3:14 pm
This topic is locked: you cannot edit posts or make replies. Extract all "IF" Statements... Adarsh Damodaran CLIST & REXX 1 Wed Sep 06, 2017 9:28 am
No new posts Join records from 2 files with No Dup... Poha Eater DFSORT/ICETOOL 22 Sun Aug 27, 2017 10:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us