View previous topic :: View next topic
|
Author |
Message |
umed
New User
Joined: 13 May 2005 Posts: 38
|
|
|
|
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 |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
umed
New User
Joined: 13 May 2005 Posts: 38
|
|
|
|
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 |
|
|
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2481 Location: @my desk
|
|
|
|
Umed
Do a forum search for 'PARSE' and 'file matching' and the solution will just follow.
Thanks,
Arun |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
|
|