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: 7315

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 Job failing with USER = 4093 REASON C... Pradeepa S ABENDS & Debugging 1 Wed May 17, 2017 3:35 pm
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm


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