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
 

 

How to write out all dropped recs from cobol user exit

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to write out all dropped recs from cobol user exit
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    Post subject: Re: How to write out all dropped recs from cobol user exit
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Fri Nov 29, 2013 2:02 am    Post subject: Reply to: How to write out all dropped recs from cobol user
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    Post subject: Reply to: How to write out all dropped recs from cobol user
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    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 Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts For each given key value, how to keep... Div Grad DFSORT/ICETOOL 7 Fri Nov 11, 2016 11:38 pm


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