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
 

 

use arithmetic operators from file in cobol program

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: use arithmetic operators from file in cobol program
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Sat Sep 24, 2011 3:20 am    Post subject: Reply to: use arithmetic operators from file in cobol progra
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

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7306

PostPosted: Sat Sep 24, 2011 4:15 am    Post subject: Reply to: use arithmetic operators from file in cobol progra
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    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 Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm
No new posts Updating a VSAM file with DISP=OLD sheersh JCL & VSAM 8 Tue Mar 14, 2017 6:14 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts TSO or command line utility to genera... kishpra JCL & VSAM 3 Thu Mar 09, 2017 1:11 am


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