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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
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
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


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