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
 

 

comparing and appending the last byte of a file using sort

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

New User


Joined: 31 Jan 2006
Posts: 8
Location: Chennai

PostPosted: Thu Dec 28, 2006 8:31 pm    Post subject: comparing and appending the last byte of a file using sort
Reply with quote

I have two PS files A and B.
Both are of the same length, say 80.

I want to compare A recs with that of B and write them to
two different ouput files C and D of length 81.

C will contain the records from A
which has matched with B, the last byte should be appended with M( Matched)

D will contain the records from A
which has not matched with B, the last byte should be appended with N( not matched).

Please let me know a solution using sort utility.

Thanks
Hema
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Dec 28, 2006 9:46 pm    Post subject:
Reply with quote

HI Hema,

Code:
//STEP0100 EXEC PGM=ICETOOL                               
//*                                                       
//TOOLMSG  DD SYSOUT=*                                   
//DFSMSG   DD SYSOUT=*                                   
//IN1      DD *                                           
AAA123BBBBBB                                             
AAA222BBBBBB                                             
AAA333CCCCCCC                                             
/*                                                       
//IN2      DD *                                           
AAA111BBBBBB                                             
AAA222BBBBBB                                             
AAA333CCCCCCC                                             
/*                                                       
//T1        DD DSN=&T1,SPACE=(CYL,(5,5),RLSE),DISP=(MOD,PASS)
//FILEA     DD SYSOUT=*                                   
//OUT       DD SYSOUT=*                                   
//TOOLIN    DD   *                                         
  COPY FROM(IN1) USING(CTL1)                               
  COPY FROM(IN2) USING(CTL2)                               
  SORT FROM(T1) USING(CTL3)                               
/*                                                         
//CTL1CNTL  DD *                                           
  OUTFIL FNAMES=T1,OUTREC=(1,80,C'1')                     
/*                                                         
//CTL2CNTL  DD   *                                         
  OUTFIL FNAMES=T1,OUTREC=(1,80,C'2')                     
/*                                                         
//CTL3CNTL  DD   *                                           
  OPTION EQUALS                                               
  SORT FIELDS=(1,13,CH,A)                                     
  SUM FIELDS=(81,1,ZD)                                       
  OUTFIL FNAMES=OUT,INCLUDE=(81,1,ZD,EQ,3),OUTREC=(1,80,C'M')     
  OUTFIL FNAMES=FILEA,INCLUDE=(81,1,CH,EQ,C'1'),OUTREC=(1,80,C'N')
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Thu Dec 28, 2006 11:18 pm    Post subject:
Reply with quote

Hema,

Do you want to compare the records on all 80 bytes, or on a particular field?

Can there be duplicate records with fileA? Can there be duplicate records within fileB?

Please show an example of the records in the input files (including duplicates within each file if appropriate) and the expected output records.
Back to top
View user's profile Send private message
madhavihmk

New User


Joined: 31 Jan 2006
Posts: 8
Location: Chennai

PostPosted: Fri Dec 29, 2006 8:24 am    Post subject:
Reply with quote

Hi Frank,

File A and File B will contain mostly the same records.

File A will be a input file and File B is an unload from a database table.
So i will be doing a comapre on the whole record, 80 bytes and there will no duplicates.

Format for the files

ModelNoVersionNo.

Eg File- A
Model1Version1
Model2Version2
Model3Version3
Model4Version4

Eg File-B
Model1Version1
Model2Version1
Model3Version2
Model4Version4


Output
File-C
Model1Version1M
Model4Version4M

File-D
Model2Version2N
Model3Version3N

This is my expected output.

Thanks
Hema
Back to top
View user's profile Send private message
madhavihmk

New User


Joined: 31 Jan 2006
Posts: 8
Location: Chennai

PostPosted: Fri Dec 29, 2006 9:04 am    Post subject:
Reply with quote

Thanks Ekta , the got the output .
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


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

PostPosted: Fri Dec 29, 2006 8:36 pm    Post subject:
Reply with quote

Hema,

Here's another way to do what you asked for with DFSORT/ICETOOL. I assumed your input has RECFM=FB and LRECL=80, but the job can be changed appropriately for other attributes.

Code:

//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/80)
//IN2 DD DSN=...  input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT1 DD DSN=...  output file1 (FB/80) - matched
//OUT2 DD DSN=...  output file2 (FB/80) - unmatched
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT1) ON(1,80,CH) ALLDUPS DISCARD(OUT2) -
  USING(CTL3)
/*
//CTL1CNTL DD *
  INREC OVERLAY=(81:C'1')
/*
//CTL2CNTL DD *
  INREC OVERLAY=(81:C'2')
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT1,INCLUDE=(81,1,CH,EQ,C'1'),
    OVERLAY=(81:C'M')
  OUTFIL FNAMES=OUT2,INCLUDE=(81,1,CH,EQ,C'1'),
    OVERLAY=(81:C'N')
/*
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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


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