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

To determine the range on a Alphanumeric field


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

New User


Joined: 22 Apr 2011
Posts: 3
Location: India

PostPosted: Mon Feb 15, 2016 9:35 am
Reply with quote

Hi,
I need help for the below requirement. Tried searching the forum, could not find answer, so posting it here.

My COBOL cics program reads data from an MQ and based on reference number present on the MQ it needs to route the message to one of the 5 output MQ's. The src-ref-no (reference number) is X(20) and it can contain numeric as well as alphanumeric and special characters like '-' etc;
I need to define the range on this src-ref-no to distribute the incoming traffic to the 5 different output mq's.

Example:
src-ref-no : abc1150235454, gps345404505, 110030040500 etc;

Each time the the program gets the same src-ref-no again and again it should route the message to the same output MQ as it was sent earlier. Something like :
if src-ref-no > range-1
go to mq-1
else if src-ref-no > range-2
go to mq-2.
.......till range-5.

how to define the range on alphanumeric items ? I can have the range hardcoded in the program or read from a db2 table.
I can rip off the special chars and apply a uniform range on the alphanumeric field too.
Please help.
Back to top
View user's profile Send private message
Prasanth Kumar

New User


Joined: 22 Apr 2011
Posts: 3
Location: India

PostPosted: Mon Feb 15, 2016 9:37 am
Reply with quote

More information:
Example:
src-ref-no : abc1150235454, gps345404505,
110030040500, abd23244545-51, aod234545-31
Back to top
View user's profile Send private message
RahulG31

Active User


Joined: 20 Dec 2014
Posts: 446
Location: USA

PostPosted: Mon Feb 15, 2016 11:54 am
Reply with quote

You don't need to define a range. All you need is a logic to identify a record(src-ref-no) to send to a particular output queue.

The logic could be anything such as: If the ref no ends with 0,5 then send to Q1, if ends with 1,6 then send to Q2, .... etc.

Similar logic can be applied for alphabets. If the first alphabet of ref no is A, F, K, P, U, Z then send to Q1, .... etc.

I don't see anything to do with COBOL or MQ here. You only needed the logic.

.
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3048
Location: NYC,USA

PostPosted: Tue Feb 16, 2016 9:59 pm
Reply with quote

You need to clear about the term Range. For me it seems the requirements are not cleared.
If you get abc1150235454 then what would you like to do? What range you want?
As you said, you can predefine the ranges in DB2 and then select the Queue name based on input src-ref-no value.
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 To get the count of rows for every 1 ... DB2 3
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts Generate random number from range of ... COBOL Programming 3
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top