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
 

 

finding unique records from 2 diff format files

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

New User


Joined: 13 May 2005
Posts: 38

PostPosted: Wed Aug 06, 2008 11:01 pm    Post subject: finding unique records from 2 diff format files
Reply with quote

Hi,

I have 2 files . One file is "|" delimited file where each record start with keyfield starting from column one. Second File is a error report which is fixed format file and the keyfield is starting from column 1 and end with column 10 ( key fields max length is 10 ) .Error Report also has header. Now I want to extract the records from file 1 which are unique to file 1 and not found in error report. I was planning to use SPLICE option but not sure as the format of the file is different. ( Error Report also contains a Header ) .

File 1 :
---------------

1234567|Umed|2008-01-01
345|Dave|2008-02-31

File 2 :
-----------

Customer Error Report 2008-08-05
345Dave Invalid Date

output File
------------
1234567|Umed|2008-01-01

Could you please guide me how I can achive this output.

Regards,
Umed
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 Aug 07, 2008 12:45 am    Post subject:
Reply with quote

You need to do a better job of explaining the "rules" for getting from input to output. Which records and fields are you comparing in the two files exactly? What is the starting position, length and format of the fields in the fixed file? How do those fields relate to the corresponding fields in the delimited file? What is the length of the individual fields you're trying to compare between the fixed file and the delimited file?

A better example (with more records) of the input records and expected output records would also help. Use bbcode tags to make your example readable.

Also, what is the RECFM and LRECL of each input file.
Back to top
View user's profile Send private message
umed

New User


Joined: 13 May 2005
Posts: 38

PostPosted: Tue Aug 19, 2008 12:33 am    Post subject: Reply to: finding unique records from 2 diff format files
Reply with quote

Frank ,

Sorry for delayed response , as we changed the format of both input files to FB . Below are the details for 2 files :

FILE1 :
---------
Format : FB
RECLEN : 45

This File is "|" delimited and contains 3 fields

1. Field_one - Maximum length = 10
2. Field_two - Maximum Length = 23
3. Field_three - Maximum length = 10

FILE2
--------
Format : FB
RECLEN : 80

This is fixed format error report with one header

1. Field_one_B - col 1 to 10
2. Field_two_B - Col 11 to 33
3. Text - Col 34 to 80

Now we need to create output file by matching field_one from file 1 with Field_one_B of File 2 and eliminate the matching record so that we will have only those records which are unique to File 1.

Here output file will have same format as that of File 1.
Example :

File 1 :
---------------
Code:

1234567|Umed|2008-01-01
345|Dave|2008-02-31


File 2 :
-----------
Code:
 
Customer Error Report 2008-08-05
345       Dave                   Invalid Date


output File
------------
Code:
 
1234567|Umed|2008-01-01


Regards,
Umed
Back to top
View user's profile Send private message
Arun Raj

Moderator


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

PostPosted: Tue Aug 19, 2008 12:49 am    Post subject:
Reply with quote

Umed

Do a forum search for 'PARSE' and 'file matching' and the solution will just follow.

Thanks,
Arun
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: Tue Aug 19, 2008 2:11 am    Post subject:
Reply with quote

Umed,

Assuming there are no duplicates within input file1, and there are no duplicates within input file2, you can use a DFSORT/ICETOOL job like the following to do what you asked for:

Code:

//S1   EXEC  PGM=ICETOOL
//TOOLMSG   DD  SYSOUT=*
//DFSMSG    DD  SYSOUT=*
//IN1 DD DSN=...  input file1 (FB/45)
//IN2 DD DSN=...  input file2 (FB/80)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(MOD,PASS)
//OUT DD DSN=...  output file (FB/45)
//TOOLIN DD *
COPY FROM(IN1) TO(T1) USING(CTL1)
COPY FROM(IN2) TO(T1) USING(CTL2)
SELECT FROM(T1) TO(OUT) ON(47,10,CH) NODUPS USING(CTL3)
/*
//CTL1CNTL DD *
  INREC PARSE=(%01=(ENDBEFR=C'|',FIXLEN=10)),
     OVERLAY=(46:C'1',47:%01)
/*
//CTL2CNTL DD *
  INREC BUILD=(46:C'2',47:1,10)
/*
//CTL3CNTL DD *
  OUTFIL FNAMES=OUT,INCLUDE=(46,1,CH,EQ,C'1'),
    BUILD=(1,45)
/*
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 Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
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
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 pm
No new posts Format record to remove Leading zeroes Learncoholic DFSORT/ICETOOL 14 Wed Apr 05, 2017 2:43 pm


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