IBM Mainframe Forum Index
 
Register
 
IBM Mainframe Forum Index Mainframe: Search Log in to check your private messages Log in
 

How to write out all dropped recs from cobol user exit


 
IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
nkrishnamoorthy

New User


Joined: 28 May 2009
Posts: 6
Location: Bangalore

PostPosted: Fri Nov 29, 2013 12:58 am
Reply with quote

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
View user's profile Send private message
nkrishnamoorthy

New User


Joined: 28 May 2009
Posts: 6
Location: Bangalore

PostPosted: Fri Nov 29, 2013 1:30 am
Reply with quote

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
View user's profile Send private message
Bill Woodger

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7312
Location: Inside the Matrix

PostPosted: Fri Nov 29, 2013 2:02 am
Reply with quote

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
View user's profile Send private message
nkrishnamoorthy

New User


Joined: 28 May 2009
Posts: 6
Location: Bangalore

PostPosted: Fri Nov 29, 2013 2:21 pm
Reply with quote

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. icon_sad.gif

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Forum Replies
No new posts Hexadecimal Group compare and write t... DFSORT/ICETOOL 5
No new posts JCL for replacing code in Cobol JCL & VSAM 8
No new posts COBOL VS SORT Utility for file format... COBOL Programming 6
No new posts XML Parsing in COBOL creating "h... COBOL Programming 0
No new posts Calling Rexx program from Cobol CLIST & REXX 12

Back to Top