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
 

 

Sort card to filter only particular record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
prabusmd

New User


Joined: 01 May 2010
Posts: 7
Location: DE

PostPosted: Fri Aug 27, 2010 2:37 am    Post subject: Sort card to filter only particular record
Reply with quote

All,

I have a file with 4 fields. Few of the records has 3 fields matching but the last field has different value ( 101 and 102). If we take first three fields these records are duplicates. If they are duplicate, i want to filter only records has 102 as 4th field. If they are not duplicate, we need to filter those records as well. The file is not in sorted order. Please help me how to handle this in sort.
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Fri Aug 27, 2010 2:43 am    Post subject: Re: Sort card to filter only particular record
Reply with quote

prabusmd wrote:
All,

I have a file with 4 fields. Few of the records has 3 fields matching but the last field has different value ( 101 and 102). If we take first three fields these records are duplicates. If they are duplicate, i want to filter only records has 102 as 4th field. If they are not duplicate, we need to filter those records as well. The file is not in sorted order. Please help me how to handle this in sort.


Please post sample data along with LRECL , RECFM, Position, Format and length of the fields involved.
Back to top
View user's profile Send private message
prabusmd

New User


Joined: 01 May 2010
Posts: 7
Location: DE

PostPosted: Fri Aug 27, 2010 8:54 am    Post subject: Reply to: Sort card to filter only particular record
Reply with quote

Hi Skolusu,

Please find the details:

LRECL : 51
File format : FB
Fields:
05 :PFX:-DETAIL-REC.
10 Field A PIC X(01).
88 A1 VALUE '0'.
88 A2 VALUE '1'.
88 A3 VALUE '9'.
10 Field B PIC 9(18).
10 Field C PIC X(03).
10 Field D PIC 9(05).
10 Field E PIC X(03).
10 Field F PIC X(02).
10 FILLER PIC X(19).

We need to filter the records with field C = 101 when D = 00100 ( mean time Field A, Field B, Field D should be same - duplicates). If D is different, we need to have those records. Only if D = 00100 we have this duplicate issue.

File example :

1000000000010002201101001007XA1 - need this in o/p file
1000000000010002201102001007XA1 - Remove it
1000000000010002601101001007XA1 - need this in o/p file
1000000000010002401102001007XA1 - need this in o/p 1000000000010002601102001007XA1 - Remove it
1000000000010002541102007007XA1 - need to have in o/p file
Back to top
View user's profile Send private message
Skolusu

Senior Member


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

PostPosted: Sat Aug 28, 2010 12:29 am    Post subject:
Reply with quote

prabhusmd,

Use the following DFSORT JCL. I assumed that if you have a record with FIELD C= '101' AND FIELD D = '00100', then remove all the duplicates for that key value at pos 2 for 18 bytes.


Code:

//STEP0100 EXEC PGM=SORT   
//SYSOUT   DD SYSOUT=*     
//SORTIN   DD DSN=your input fb lrecl 51 byte file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                             
//SYSIN    DD *                                                     
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(52:SEQNUM,8,ZD)),               
  IFTHEN=(WHEN=(20,8,CH,EQ,C'10100100'),OVERLAY=(52:8X))           
  SORT FIELDS=(2,18,CH,A,52,8,CH,A),EQUALS   
                       
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(61:SEQNUM,8,ZD,RESTART=(2,18))),
  IFTHEN=(WHEN=GROUP,BEGIN=(61,8,ZD,EQ,1),PUSH=(52:52,8))           
  OUTFIL BUILD=(1,51),OMIT=(52,8,CH,EQ,C' ',AND,61,8,ZD,GT,1)       
//*
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 -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts How to delete second instance from Fl... Gunapala CN DFSORT/ICETOOL 6 Tue Oct 18, 2016 11:42 pm


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