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
 

 

File comparison with Evaluate

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: File comparison with Evaluate
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Apr 12, 2011 1:27 pm    Post subject:
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    Post subject:
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    Post subject: File comparision
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Tue Apr 12, 2011 2:54 pm    Post subject:
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    Post subject:
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
http://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: 1712
Location: UK

PostPosted: Tue Apr 12, 2011 5:25 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject:
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7223

PostPosted: Wed Apr 13, 2011 5:15 pm    Post subject:
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    Post subject:
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: 1738
Location: Bloomington, IL

PostPosted: Thu Apr 14, 2011 1:43 am    Post subject:
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    Post subject:
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: 743
Location: Germany

PostPosted: Thu Apr 14, 2011 5:00 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm
No new posts Problem in writing Output file vickey_dw COBOL Programming 5 Mon Nov 14, 2016 11:14 pm


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