View previous topic :: View next topic
|
Author |
Message |
nkrishnamoorthy
New User
Joined: 28 May 2009 Posts: 6 Location: Bangalore
|
|
|
|
I have a COBOL User Exit Routine that extracts record from an input file (which has a matching entry in a look up file). The extracted records are written to an output file.
My requirement is to write out even the non matching (or) non extracted records into a separate output file.
Input file-1 (i.e. Main input file. Key field is first 5 bytes in Character format. This file can be either FB or VB with max record length of 100 bytes):
Code: |
----+----1----+----2----+----3----+----4----+----5
AAAAA record 1
BBBBB record 2
CCCCC record 3
DDDDD record 4
EEEEE record 5
|
Input file-2 (i.e. Look up file. Key field is first 5 bytes in Character format. The Cobol user exit routine accesses this file directly):
Code: |
----+----1----+----2
AAAAA
CCCCC
|
DFSORT passes a record from Input file-1 into the Cobol user exit routine. The routine reads a record directly from Input file-2 and then compares the keys of both files.
- If Keys match, the routine sets the RETURN-CODE value as 00 and returns the record (of Input file-1) back to DFSORT. DFSORT then writes out the record into the Output file-1.
- If Keys do not match, the routine sets the RETURN-CODE value as 04 and returns the record (on Input file-1) back to DFSORT. DFSORT drops/deletes this record from writing into output file-1.
Now my requirement is to write out all dropped records into a separate file (say output file-2).
Output file-1 (matching entries):
Code: |
----+----1----+----2----+----3----+----4----+----5
AAAAA record 1
CCCCC record 3
|
Output file-2 (non matching entries):
Code: |
----+----1----+----2----+----3----+----4----+----5
BBBBB record 2
DDDDD record 4
EEEEE record 5
|
The above mentioned Output file-2 with same format of Input file-1 is what i'm struggling to achieve.
i.e.
- If Input file-1 is FB 100 bytes then I want even the Output file-2 to also be FB 100 bytes.
- If Input file-1 is VB 100 bytes then I want even the Output file-2 to also be VB 100 bytes.
If I let the COBOL user exit routine to directly write out all non-matching entries directly into output file-2, then it will always have to be a VB file (because the input file can be either FB/VB).
Can anyone please help? Thanks. |
|
Back to top |
|
|
nkrishnamoorthy
New User
Joined: 28 May 2009 Posts: 6 Location: Bangalore
|
|
|
|
nkrishnamoorthy wrote: |
Clarifying my requirement:
The above mentioned Output file-2 with same format of Input file-1 is what i'm struggling to achieve.
i.e. for example:
- If Input file-1 is FB 100 bytes then I want even the Output file-2 to also be FB 100 bytes.
- If Input file-1 is VB 50 bytes then I want even the Output file-2 to also be VB 50 bytes.
Can anyone please help? Thanks. |
|
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
How about showing the code you have?
How do you know your input is fixed or variable?
Why don't you set a marker and let SORT do the output?
What is it about your look-up which requires it to be in an EXIT? |
|
Back to top |
|
|
nkrishnamoorthy
New User
Joined: 28 May 2009 Posts: 6 Location: Bangalore
|
|
|
|
Quote: |
How about showing the code you have? |
Sorry! I wish i could to get your views by showing the code but unfortunately I'm are not supposed to.
Quote: |
How do you know your input is fixed or variable? |
I missed about the other input file-3 (which we call as paramter file) which will have details of Input file-1 i.e. whether input file-1 is of FB/VB, its record length etc. The cobol user exit directly accesses this parameter file (i.e. to open, read and close).
Quote: |
Why don't you set a marker and let SORT do the output? |
Yeah this option also sounds good but can you please given an example of how this can be done?
Quote: |
What is it about your look-up which requires it to be in an EXIT? |
Nothing very specific but this is how our business requirement was i.e. to use a COBOL user exit to extract both matching and non-matching entries into separate files. Perhaps I could do as you suggested in your above point i.e. set up a marker at the last character of every record in COBOL user exit and instead of setting RETURN-CODE as 04 for non-matching entries I could set it as 20 (to indicate that the record is changed/updated).
Please let me know your views. |
|
Back to top |
|
|
|