IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Sort card to filter only particular record


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts JCL sort card - get first day and las... JCL & VSAM 9
Search our Forums:

Back to Top