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

Comparing columns in same file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kaleelahamed

New User


Joined: 08 Jun 2006
Posts: 45
Location: Trumbull, CT

PostPosted: Fri Aug 29, 2008 5:38 pm
Reply with quote

Hi,

My Input File,
Code:
----+----1----+----2----+----3----+
G3A8420CFP478296..|G3A8420CFP478296
G3A8838FFS855437..?G3A3707FFS855437
G3G3835FFS595971...G3B4512FFS595971
G3!4512CC0W3000K..±G3B4512CC0W3000K
G3!4512CC0W3087K..±G3B4512CC0W3087K
G3!4512CC0W3320G..±G3B4512CC0W3320G
G3!4512CC0W3331G..±G3B4512CC0W3331G
G3B1013FFT161151...G3B2203FFT161151


Output File:
Code:
----+----1----+----2----+----3----+
G3A8420CFP478296..|G3A8420CFP478296
G3A8838FFS855437..?G3A3707FFS855437
G3B1013FFT161151...G3B2203FFT161151


In the output file created, it should not contain the records in which the 3rd AND 22nd COLUMN are different. Else the whole record should be copied in output file. The input file can have duplicates.

The input and output file LRECL is 35. The 3rd and 22nd position can hav special characters also.

Can this be done by DFSORT?

I believe we can get the output by using SPLICE option. Currently I am trying by level best to get the output using the SPLICE option in ICETOOL.

Can any one of please guide me to get the expected results?
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Aug 29, 2008 6:45 pm
Reply with quote

I've assumed that the records are FB
Code:

//CONCAT   DD DSN=&&TEMP01,DISP=(MOD,PASS,DELETE),     
//            SPACE=(TRK,(10,10),RLSE),                 
//            RECFM=FB,LRECL=80                         
//CONCAT2  DD DSN=&&TEMP02,DISP=(MOD,PASS,DELETE),     
//            SPACE=(TRK,(10,10),RLSE),                 
//            RECFM=FB,LRECL=80                         
//OUT      DD SYSOUT=*                                 
//TOOLIN   DD *                                         
*                                                       
  COPY FROM(IN1) TO(CONCAT) USING(CPY1)                 
*                                                       
  COPY FROM(IN1) TO(CONCAT) USING(CPY2)                 
*                                                       
  SPLICE FROM(CONCAT) TO(CONCAT2) ON(37,1,CH) WITH(38,1)
*                                                       
  COPY FROM(CONCAT2)  TO(OUT) USING(CPY3)               
/*                                                     
//CPY1CNTL DD *                                         
  OUTREC BUILD(1,35,X,3,1)                             
/*                           
//CPY2CNTL DD *               
  OUTREC BUILD(1,35,X,22,1,X)
/*                           
//CPY3CNTL DD *               
  OUTREC BUILD(1,35)         

Result
Code:

G3!4512CC0W3000K..±G3B4512CC0W3000K
G3A8420CFP478296..|G3A8420CFP478296
G3B1013FFT161151...G3B2203FFT161151
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Fri Aug 29, 2008 7:04 pm
Reply with quote

kaleelahamed,

The below SORT job does what you asked for.
Code:
//STEP1    EXEC PGM=ICEMAN                                 
//SYSOUT   DD SYSOUT=*                                     
//SORTOUT  DD SYSOUT=*                                     
//SORTIN   DD DSN=your.input.file....>FB,LRECL=35                                           
//SYSIN    DD *                                           
  INREC IFTHEN=(WHEN=INIT,OVERLAY=(36:C'0')),             
        IFTHEN=(WHEN=(3,1,CH,NE,22,1,CH),OVERLAY=(36:C'1'))
  OPTION COPY                                             
  OUTFIL OMIT=(36,1,CH,EQ,C'1'),BUILD=(1,35)               

SORTOUT
Code:
G3A8420CFP478296..|G3A8420CFP478296
G3A8838FFS855437..?G3A3707FFS855437
G3B1013FFT161151...G3B2203FFT161151


expat,
The 3rd and 22nd characters in the first record of your output differ.

Thanks,
Arun
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 29, 2008 7:40 pm
Reply with quote

kaleelahamed,

It is a simple case of using an OMIT cond. expat and arcvns made it complicated. The following DFSORT JCL will give you the desired results
Code:

//STEP0100 EXEC PGM=ICEMAN             
//SYSOUT   DD SYSOUT=*                 
//SORTIN   DD *                       
G3A8420CFP478296..|G3A8420CFP478296   
G3A8838FFS855437..?G3A3707FFS855437   
G3G3835FFS595971...G3B4512FFS595971   
G3!4512CC0W3000K..±G3B4512CC0W3000K   
G3!4512CC0W3087K..±G3B4512CC0W3087K   
G3!4512CC0W3320G..±G3B4512CC0W3320G   
G3!4512CC0W3331G..±G3B4512CC0W3331G   
G3B1013FFT161151...G3B2203FFT161151   
//SORTOUT  DD SYSOUT=*                 
//SYSIN    DD *                       
  SORT FIELDS=COPY                     
  OMIT COND=(3,1,CH,NE,22,1,CH)       
/*


Hope this helps...

Cheers
Back to top
View user's profile Send private message
kaleelahamed

New User


Joined: 08 Jun 2006
Posts: 45
Location: Trumbull, CT

PostPosted: Mon Sep 01, 2008 10:55 am
Reply with quote

Thanks Skolusu!

The solution perfectly works....
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Mon Sep 01, 2008 1:47 pm
Reply with quote

Thanks are echoed. This is a new syntax for me.

Thank you.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Mon Sep 01, 2008 9:57 pm
Reply with quote

Quote:
This is a new syntax for me.


Really? This syntax has been part of DFSORT for decades. Perhaps you might want to go through "z/OS DFSORT: Getting Started" to see what else you're not aware of. You can find it at:

Use [URL] BBCode for External Links
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 -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
Search our Forums:

Back to Top