IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

File comparison with Evaluate


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Skss

New User


Joined: 16 Feb 2010
Posts: 46
Location: India

PostPosted: Tue Apr 12, 2011 1:22 pm
Reply with quote

Hi,

I have a requirement in which I have 2 input files. The structure of both the files are similar.

The requirement is: Check the field of file 1 against file 2. Check the value untill a match is found. If no match found then please write it into a discard file. If match found then write it to the output file.

I have tired with Evaluate and here is my code but it is not working as per my requirement.
PROCESS-INPUT.
EVALUATE TRUE

WHEN PART-NUMBER-FILE1 > PART-NUMBER-FILE2
PERFORM WRITE-PART-NTFND THRU WRITE-PART-NTFND-EXIT
PERFORM READ-FILE2 THRU READ-FILE2-EXIT

WHEN PART-NUMBER-FILE1 < PART-NUMBER-FILE2
PERFORM WRITE-DISCARD THRU WRITE-DISCARD-EXIT
PERFORM WRITE-PART-NTFND THRU WRITE-PART-NTFND-EXIT
PERFORM READ-FILE1 THRU READ-FILE1-EXIT

WHEN PART-NUMBER-FILE1 = PART-NUMBER-FILE2
PERFORM WRITE-PART THRU WRITE-PART-EXIT
PERFORM READ-FILE2 THRU READ-FILE2-EXIT
PERFORM READ-FILE1 THRU READ-FILE1-EXIT

WHEN OTHER DISPLAY '** FATAL ERROR, PLEASE FIX IT **'

END-EVALUATE.
Please advice which would fullfill my requirement.

Thank you,
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Tue Apr 12, 2011 1:27 pm
Reply with quote

It might not be working, but wat is it doing? I assume both files are sorted? Duplicates? Or not? There is a "sticky" for file matching at the top of this forum. Has that been any use to you?
Back to top
View user's profile Send private message
Skss

New User


Joined: 16 Feb 2010
Posts: 46
Location: India

PostPosted: Tue Apr 12, 2011 2:36 pm
Reply with quote

thanks for your response

yes the files are sorted, without any duplicates.

Where can I find the sticky?

Please let me know if you see any modification to be done to the existing code.
Back to top
View user's profile Send private message
Skss

New User


Joined: 16 Feb 2010
Posts: 46
Location: India

PostPosted: Tue Apr 12, 2011 2:43 pm
Reply with quote

I checked the sticky and it does not display as a formatted program.

if you have the original sticky then could you just mail me @ ssamantasinghar@gmail.com
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Tue Apr 12, 2011 2:54 pm
Reply with quote

The program is in an "attachment" (look for the paper-clip icon).

It is logic that works, and has worked for many years. Not mine, by the way. You'll have to put your specific stuff in the right sort of places.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 12, 2011 3:01 pm
Reply with quote

Quote:
I checked the sticky and it does not display as a formatted program.


have no idea what you mean.
if you mean that it is not written in a modularized manner (it uses goto's)
then you are correct.

but you want the original sticky, which is there.
not to belabor the point of your inability to navigate thru this website
ibmmainframes.com/viewtopic.php?t=22649

Now, back to your code.

you only provide us with an EVALUATE statement, which as Bill mentioned,
seems ok.
That you perform thru exit's,
instead of simply performing SECTIONs (apparently you don't use SECTIONs)
is one cause for alarm.

having no idea what your performed routines do,
and no idea of what your output is,
actually only seeing some [unCODE tagged code],
which in itself tends to indicate that you are not much of an IT Solution provider
and have very basic COBOL skills.

SORT JOINKEYS could provide a very easy solution to your problem.
But you want it in COBOL.
you have an isolated EVALUATE
you have not provided any loop control code,
how do you load the input to start?

you are having a problem with your output.
I suggest that you are spending too much time trying to find the fault in the EVALUATE
and not spending enough time with the basic control code
nor with the PERFORMed routines.
and within the last two lies lies your problem.
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 2454
Location: Hampshire, UK

PostPosted: Tue Apr 12, 2011 5:25 pm
Reply with quote

Quote:
WHEN OTHER DISPLAY '** FATAL ERROR, PLEASE FIX IT **'


What use is this error message? It gives no dignostic informtion to help one fix the problem. Just further emphasises Dick's comments.
Back to top
View user's profile Send private message
Skss

New User


Joined: 16 Feb 2010
Posts: 46
Location: India

PostPosted: Wed Apr 13, 2011 8:48 am
Reply with quote

thanks guys for your response

My issue has been resolved now and it is doing what I want it to do.

As per Dick, yes my shop wont allow me to use GOTO statements at all.

The problem was with the end of file condition.

I added an additional check for both the input files and it is working fine now.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Apr 13, 2011 9:33 am
Reply with quote

which means my analysis of your EVALUATE statement was incorrect.

congratulations for finding the problem,
I apologize for my lack of help.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Wed Apr 13, 2011 2:50 pm
Reply with quote

I would also like to correct my previous comment
where I suggested that BILL thought the EVALUATE was ok.

He did not say that.

add this to my list of errors in this thread.
Back to top
View user's profile Send private message
Bill Woodger

Moderator Emeritus


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

PostPosted: Wed Apr 13, 2011 5:15 pm
Reply with quote

dbzTHEdinosauer wrote:

I suggest that you are spending too much time trying to find the fault in the EVALUATE
and not spending enough time with the basic control code
nor with the PERFORMed routines.
and within the last two lies lies your problem.


Credit where it is due, you were exactly right here Dick.

If a particular piece of code looks right, but the program isn't working, it is a very good idea to look elsewhere. It might seem an obvious thing to say, but I've said it so often myself in the "real" world that I know it can take someone from "outside" the problem to be able to say it to you. If you remember this, Skss, it'll help you a lot in the future. And when you say it to someone else and it helps them fix their problem, they'll think you are really clever. Deny it, tell them Dick told you, and you learned from it. Then they'll maybe learn as well.
Back to top
View user's profile Send private message
Peter Nancollis

New User


Joined: 15 Mar 2011
Posts: 47
Location: UK

PostPosted: Thu Apr 14, 2011 1:12 am
Reply with quote

Quote:
my shop wont allow me to use GOTO statements at all.

I know it happens but ....
real programmers aren't afraid of GOTOs
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1787
Location: Bloomington, IL

PostPosted: Thu Apr 14, 2011 1:43 am
Reply with quote

Skss wrote:
my shop wont allow me to use GOTO statements at all.

I once worked in a shop like that. I wrote a preprocessor that allowed me to use COME FROM statements in PL/I programs icon_evil.gif
Back to top
View user's profile Send private message
Skss

New User


Joined: 16 Feb 2010
Posts: 46
Location: India

PostPosted: Thu Apr 14, 2011 8:59 am
Reply with quote

[real programmers aren't afraid of GOTOs]

I agree.....in my previous shop also I have used GOTOs in many programs.....but sometimes the coding standards are set by people on there personal choice and we have to live with it icon_biggrin.gif [/quote]
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 771
Location: Germany

PostPosted: Thu Apr 14, 2011 5:00 pm
Reply with quote

@ Peter Nancollis & Skss

>> ...real programmers aren't afraid of GOTOs


Ok sir, but real programmers need no GOTO Statement in Cobol anyway.

They don't even need a Branch-Command in Assembler, if they use the old IBM Structured Macros for ASM.

Nice Weekend
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Apr 14, 2011 7:07 pm
Reply with quote

i am not afraid to use goto's,
but the other fools scare me to death.

we relaxed our standards and allowed goto's to the end of section.
we also said, last para in a section
WILL ALWAYS BE: 9999-END.

but, of course they had to put the section name with -end as the last.
so, then they copy sections to do similar things and don't change the
goto's.

The more freedom you give a rookie
(or 10 years experience doing the same thing for 10 years - 10 year rookie)
the more problems he will create.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Unable to interpret a hex value to De... COBOL Programming 4
No new posts how to eliminate null indicator value... DB2 7
No new posts Format Binary file to EBCDIC JCL & VSAM 4
No new posts Binary File format getting change whi... All Other Mainframe Topics 7
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
Search our Forums:

Back to Top