View previous topic :: View next topic
|
Author |
Message |
Mazahar
New User
Joined: 11 Dec 2007 Posts: 82 Location: hyderabad
|
|
|
|
Hello,
Can you please suggest how can we do this
File1 is FB of length 240
File2 is FB of length 240
File1
Code: |
1 ABCD 1234567890
1 ABCDE 1234567890
1 ABCDEF 1234567890
1 ABCDEFG 1234567890
1 ABCDK 1234567890
1 ABCDL 1234567890 |
FILE2
Code: |
1 ABCD
2 MNOP
3 XYZX
1 ABCDE
2 MNOP
3 XYZX
4 MAZA
1 ABCDEF
2 MNOP
3 XYZX
4 MAZA
10 PAWA
1 ABCDEFG
2 MNOP
3 XYZX
4 MAZA
10 PAWA
1 ABCDK
2 MNOP
3 XYZX
5 MAZA
1 ABCDL
4 MNOP
5 XYZX
6 MAZA |
Output should be
Code: |
1 ABCD 1234567890
1 ABCD
2 MNOP
3 XYZX
1 ABCDE 1234567890
1 ABCDE
2 MNOP
3 XYZX
4 MAZA
1 ABCDEF 1234567890
1 ABCDEF
2 MNOP
3 XYZX
4 MAZA
10 PAWA
1 ABCDEFG 1234567890
1 ABCDEFG
2 MNOP
3 XYZX
4 MAZA
10 PAWA
1 ABCDK 1234567890
1 ABCDK
2 MNOP
3 XYZX
5 MAZA
1 ABCDL 1234567890
1 ABCDL
4 MNOP
5 XYZX
6 MAZA |
* We are nothing but comparing two files and copying data from file2 to output file by merging records from file1
* File1 and file2 records which starts with record type 1 needs to be compared for first 100 bytes, if file1 recordtype 1 first 100 bytes are equal to file2 record type1 first 100 bytes we need to copy file 1 record with type1 to output file before copying records of file2
* there wont be any dublicates in file1 and file2, there will be only one match for record type1
please suggest |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Mazhar,
Can there be orphan records in either files? If yes, please show sample records and expected output.
Also, refer to below post and provide your dfsort function level.
ibmmainframes.com/viewtopic.php?t=33389
Thanks, |
|
Back to top |
|
|
Mazahar
New User
Joined: 11 Dec 2007 Posts: 82 Location: hyderabad
|
|
|
|
Quote: |
Can there be orphan records in either files? If yes, please show sample records and expected output. |
No there wont be any orphan records, there will be a corresponding record type 1 of file1 in file2
Quote: |
refer to below post and provide your dfsort function level. |
2008 DFSORT functions will support[/quote] |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Mazahar,
I am not trying to be picky but...
Quote: |
No there wont be any orphan records, there will be a corresponding record type 1 of file1 in file2
|
and vice-versa?
Also based on your sample input, your first 100 bytes doesn't match for 2 files, For example, "1 ABCD" has 1 space between 1 and A and file2 record is "1 ABCD" has 3 spaces!!!
Please explain this rule.
Thanks, |
|
Back to top |
|
|
Mazahar
New User
Joined: 11 Dec 2007 Posts: 82 Location: hyderabad
|
|
|
|
Sqlcode,
Thanks for the responce, Yes, its vice-versa
Record format is record type starts at first byte in both the files and then two bytes spaces then actual data starts.
Thank You |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Mazahar,
Assuming 2 byte record type starting at 1st position (Record "10 PAWA"). If your record type is 1 byte, then change BEGIN condition to use 1,1,zd...
Code: |
//STEP0001 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=TEST.FB25001
// DD DISP=SHR,DSN=TEST.FB25002
//SORTOUT DD SYSOUT=*
//SYSIN DD *
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,2,ZD,EQ,1),PUSH=(252:1,100))
SORT FIELDS=(252,100,CH,A),EQUALS
OUTFIL BUILD=(1,250)
/*
|
Thanks, |
|
Back to top |
|
|
Mazahar
New User
Joined: 11 Dec 2007 Posts: 82 Location: hyderabad
|
|
|
|
SQL CODE
I am getting below error can you please suggest if push increases the size of record
Sortin : RECFM FB ; LRECL=240
INREC record length 351
potentially in sufficient use of inrec
sortout recfm=fb,lrecl=240
Please suggest |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Mazahar,
When posting error messages, make sure you post message id to identify your sort product. Looks like you have Syncsort installed.
Code: |
WER238I POTENTIALLY INEFFICIENT USE OF INREC |
Just my 2 cents. If you have DCB parameters coded for output file, remove them and rerun the same job.
Quote: |
I am getting below error can you please suggest if push increases the size of record |
Yes, refer to your product manual.
Thanks, |
|
Back to top |
|
|
|