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
 

 

Putting the selection criteria in a table/file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
shilpa.khaire

New User


Joined: 21 Jul 2006
Posts: 39
Location: US

PostPosted: Tue Jun 30, 2009 12:24 am    Post subject: Putting the selection criteria in a table/file
Reply with quote

Hi all!

I want to mtch 2 files based on a certain field. Which is pretty easy if I sort the 2 files on a certain key field. But I have a selection criteria or a decision table which I need to use. The decision table looks like this:
Priority Field1 Field 2 Field3 Field4
1 A abc
2 B C def
3 B D ghi
Now Field 1 is present in the first file. So I need not match with the second file. For Field 2 and 3 are present in the second file, so I need to match file1 to file2 based on a key field. SO I was thinking of making this selection criteria dynamic by putting it into a file or an internal table? Is this possible?

Thanks!
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jun 30, 2009 1:56 am    Post subject:
Reply with quote

Hello,

You wil get more useful replies if you take a bit more time and more completely describe what you are trying to do.

Show representative sample data from each input file and the output(s) you want when your process is run.

The rules you've posted may be all that is needed depending on the clarity of the inputs and output(s).
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Jun 30, 2009 2:57 am    Post subject:
Reply with quote

use bbcode, specifically code tags - they will preserve the horizontal spacing.

and this is a pile of dog-poop!
Quote:

Priority Field1 Field 2 Field3 Field4
1 A abc
2 B C def
3 B D ghi


How do you expect us to interpret that?

and you show a Field4 in your matrix, yet you mention nothing in your explanation.
Back to top
View user's profile Send private message
shilpa.khaire

New User


Joined: 21 Jul 2006
Posts: 39
Location: US

PostPosted: Tue Jun 30, 2009 7:46 am    Post subject:
Reply with quote

Code:

Priority Field1 Field 2 Field3   Field4
1           A                       abc
2                    B       C      def
3                    B       D      ghi


Now the first input file has Field 1 and the second input file has Field 2 and 3. And I expect to populate one field in the output file with Field 4.
E.g. 1 - If first file has Field 1 = A, then I need to populate one filed in the output as 'abc'.
E.g. 2. - If the first file does not have Field1 = A then I have to match file 1 and file 2 based ona key field and then if a match is found I have to look for Fields 2 and 3 in File 2. If Fields 2 and 3 in File2 are 'B' and 'C' respectively then I need to populate one filed in the output as 'def' .And so on. So I wanted to have this above decision table in a parm or a file and then lookup this decision table and populate the field in the output file with abd/def/ghi. Is this possible? What could be the differnt options instead of hardcoding as If-ELSE in the program?

Thanks!
Quote:
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8002
Location: Bellevue, IA

PostPosted: Tue Jun 30, 2009 8:18 am    Post subject:
Reply with quote

Considering how specific your example is, why would you NOT want to hard-code the IF statements? Do you really expect to have this set of conditions show up again sometime in the future?

If the files are indexed and keyed, you could do key look ups to do the matches; otherwise, the logic could get quite complex. You could code this up in a decision table, but the additional coding and complexity probably would negate any perceived benefit of using a decision table.

For example, what if the first file has Field1 = 'B' and file 1 and file 2 do not have a key match? Nothing you've posted yet indicates what is to be done in this case. So it does not appear at this point that you even have a decision table -- just part of one.

Furthermore, matching implies the files are sorted in the same sequence -- unless you want to do an unsorted match, which can drive I/O counts (and run times) extremely high with relatively small files.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Jun 30, 2009 8:47 am    Post subject:
Reply with quote

Hello,

If you were to post something more "real" than alphabet soup, someone has probably already implemented what you are looking for.

If specifics are used to work thru a (this) topic, it might be made generic later.

An un-sorted file "match" should be limited to all files having no more than 10 records. . . It is possibly the poorest choice that can be made for combining data.
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 Data replication from multiple Db2 ta... kishpra DB2 5 Mon Mar 27, 2017 9:58 pm
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm


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