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

use arithmetic operators from file in cobol program


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

New User


Joined: 08 Dec 2005
Posts: 48
Location: Chennai

PostPosted: Sat Sep 24, 2011 2:39 am
Reply with quote

I have files as below and need to compare their values. I need to use the arithmetic operators like <,<=,>,>=,= present in one of the input files in the cobol code for comparing 2 fields. Is it possible to handle?

Input file 1:
A
-442.2
2089.00
-2700.00

Input file 2:
B B1 C
< 1000 1
>= 1000 2
> 1000 3
****B contains <,>=,> and B1 contains 1000 and C contains 1,2,3
I'm loading the file 2 into a table for searching the values
Cobol check:
IF A <B1(1)
Move C(1) to output file
ELSE
IF A>=B1(2)
Move C(2) to output file
ELSE
IF A>B1(3)
Move C(3) to output file
END-IF
END-IF
END-IF

*****I need to know if I can use Column B directly in the code instead of hardcoding <,>,etc in the cobol code. This is because the conditions are bound to change by the users any time and they want a dynamic code.
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: Sat Sep 24, 2011 3:20 am
Reply with quote

Firstly, find out how to use the Code tags. You've been here a long time, and made 45 posts, so should have got it by now.

Also, have a look at the surprising number of recent questions on this sort of topic.

The answer is No.

One handy thing about compiled code is that you just can't change it willy-nilly as you go along at run-time. Means you stand a chance of testing and getting reliable results.
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: Sat Sep 24, 2011 4:15 am
Reply with quote

For your limited example it is not difficult to code to treat this as a "dynamic" thing anyway. Bear in mind that although it is not difficult, it has to be correct, understandable and maintainable.

Someone has to be responsible for changing the data, and changing it correctly, when needed. You need to programmatically verify the data before it can be used (you have an "elseless" example, so, for instance, need to ensure that the conditions do not leave anything to "else"). You need a full audit-trail of changes. You need to take this file into account for re-runs and things like that.

If you are looking to apply this to your whole system so there don't have to be any more program changes, look through the other recent topics and see what you are facing.
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 Compare 2 files and retrive records f... DFSORT/ICETOOL 2
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
Search our Forums:

Back to Top