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
 

 

Selecting some records based on few fields.

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

New User


Joined: 09 Jul 2007
Posts: 59
Location: Chennai

PostPosted: Mon May 05, 2008 2:42 pm    Post subject: Selecting some records based on few fields.
Reply with quote

I have a file which contains 36 million records.

Sample records are shown below.

Code:
100ABCDE2007022299999999
100ABCDE2007090499999999
101ABCDE2007091299999999
101ABCDE2007091220080715


Out of the above four records i need to select only the 3rd record.

As you can see the first 16 digits of this record is equal to the next record and the next 8 digits are different. So i want only such records whose first 16 digits are equal to the first 16 digits of next record and last 8 digits are not equal to the last 8 digits of the next record.

Please let me know how to achieve this using SORT.
Back to top
View user's profile Send private message

rajatbagga

Active User


Joined: 11 Mar 2007
Posts: 188
Location: india

PostPosted: Mon May 05, 2008 6:08 pm    Post subject:
Reply with quote

hello Mariraj,

I had understood your requrement then you can use the below JCL. if this does not works then please let us know with some examples with more then one record in the output:

Code:
//VZM1CKKN JOB (3GAHF3,R),                                           
//         'RAJAT TEST',CLASS=X,MSGCLASS=Y,NOTIFY=&SYSUID             
//S1      EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                               
//DFSMSG   DD SYSOUT=*                                               
//*                                                                   
//IN1      DD *                                                       
100ABCDE2007022299999999                                             
100ABCDE2007090499999999                                             
101ABCDE2007091299999999                                             
101ABCDE2007091220080715                                             
/*                                                                   
//T1       DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)   
//OUT      DD SYSOUT=*                                               
//TOOLIN   DD *                                                       
    SELECT FROM(IN1) TO(T1) ON(1,16,CH) FIRST                         
    SELECT FROM(T1) TO(OUT) ON(17,8,CH) LAST                         
/*                                                                   
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Mon May 05, 2008 11:34 pm    Post subject:
Reply with quote

Mariraj,

Do you always have just 2 records for every key on the first 16 bytes or can you have more than that? if you have more than 2 keys how do u compare ? Also what is the LRECL and RECFM of the input dataset?


rajatbagga,

Your JCL will NOT give you the desired results as u are considering only FIRST of every record which would eliminate the 2nd record to be checked and your next select is only checking for the 8 bytes on ALL records. It should be checking based on the KEY in the first 16 bytes.

Try running your job with the following Data. Change the 1st record

Code:

100ABCDE2007022277777777
100ABCDE2007090499999999
101ABCDE2007091299999999
101ABCDE2007091220080715

and you will see that you got 2 records in the output.
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 JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts Join giving more records than expected Danielle.Filteau SYNCSORT 2 Thu Mar 09, 2017 3:28 am
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am
No new posts Extract set of records matching on ac... bhaskar_kanteti DFSORT/ICETOOL 3 Mon Mar 06, 2017 7:19 am
No new posts DFSORT MUL FIELDS tspr52 DFSORT/ICETOOL 16 Fri Mar 03, 2017 11:53 pm


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