Page 1 of 1

Need help in COBOL code logic.

Posted: Fri Feb 16, 2018 11:26 am
by Nagaraju H
Good Morning!

I want a code/logic for the below COBOL code.

In a input file records are like below:

Code: Select all

212Q64 0000 0999 10
212Q64 1000 1999 11
212Q64 2000 2999 25
212Q64 3000 3999 16
212Q64 4000 4999 18
212Q64 5000 5999 31
212Q64 6000 6999 35
212Q64 7000 7999 12
212Q64 8000 8999 48
212Q64 9000 9999 66
I have another input file which has accounts with 10 bytes, for example: 212Q642121.

The requirement is when the first 6 bytes of the account (212Q64 in the above example account number) is matching with the another file records of 6-bytes (which stated in column-1 above), then should check other last 4 bytes of account number from 212Q64-2121 is in which range(it belongs to 2000 2999 in the above example), then should pick it's corresponding value as 25...

Could you please tell me how to do it?

I have written matching logic thing already, but I need the other part of 4 bytes checking and pick the last column value

Re: Need help in COBOL code logic.

Posted: Fri Feb 16, 2018 5:17 pm
by nicc
What is your problem? Is it so hard to take the last 4 bytes from the data set (not "file" unless you are not on a mainframe in which case the question should not be here) and see if it is greater than 1900 and less than 3000 then value to use is 25?
Unless there is something that you have not told us?

Re: Need help in COBOL code logic.

Posted: Fri Feb 16, 2018 6:11 pm
by Robert Sample
This is a simple application of table processing in COBOL. Create and load the table, then read the other data set's record and search the table.