Need help in COBOL code logic.

OS/VS COBOL, COBOL II, Enterprise COBOL for z/OS. OpenCOBOL and OOCobol.
Post Reply
User avatar
Nagaraju H
New Member
Posts: 1
Joined: Fri Feb 16, 2018 11:18 am

Need help in COBOL code logic.

Post 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
Last edited by Anuj Dhawan on Fri Feb 16, 2018 11:36 am, edited 1 time in total.
nicc
Global Moderator
Global Moderator
Posts: 691
Joined: Wed Apr 23, 2014 8:45 pm

Re: Need help in COBOL code logic.

Post 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?
Regards
Nic
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1885
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

Re: Need help in COBOL code logic.

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “IBM COBOL, GnuCOBOL (OpenCOBOL), OOCobol.”