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
 

 

Alphanumeric sequence number

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

New User


Joined: 30 Sep 2008
Posts: 2
Location: Chennai

PostPosted: Tue Feb 26, 2013 9:13 pm    Post subject: Reply to: Increment Character value say from A to B using Co
Reply with quote

i have the same scenario which needs to done through the cobol program.

For example: A99999 reached Program need to switch to B00001.
Numeric part I have handled through DB2 Sequence object. Only thing is when the sequence reset to 00001 I need a function or logic which will change the A to B.

I;e I know when to change A to B, but only thing is how can I code to change A to B.

If there is any way to do this please suggest. If no way then I need to hard code the values in WS variables and once sequence reaches the limit then I will change to B.

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

Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Tue Feb 26, 2013 9:26 pm    Post subject: Reply to: Alphanumeric sequence number
Reply with quote

Please don't tailgate an old topic, but post a new one. If you feel it helps, include a link to the topic which you feel is helpful.

Why does A99999 go to B00001? What happened to B00000?

Why are you using DB2?

There are many ways to do what you want. Can you not think of anything? How about a table with 26 entries containing the letters of the alphabet. You start with the first entry. When you get to 99999 you "roll" to 00000 (or 00001) and use the "next" entry from the table. Continue ad not-quite-infinitum-but-until-you've-done-it-all.
Back to top
View user's profile Send private message
pravinjanawork

New User


Joined: 30 Sep 2008
Posts: 2
Location: Chennai

PostPosted: Wed Feb 27, 2013 12:10 am    Post subject: Reply to: Alphanumeric sequence number
Reply with quote

Bill - Thanks for your suggestion. I would take care in future and will not tail gate in old topic. I posted my query to this topic since the topic was almost related to my problem.

I have not yet concluded language to write the code for this requirement. Based on the available functionality I may write either in COBOL store procedure or through Native SQL store procedure.

So i was thinking about the Sequence object. Yes, I thought different ways but all of them require some hard coding inside the program.

For example if we have 26 alphabets in a table after reaching A99999 then I need to correctly start with B, for this I need to hard code.

So i was looking for any Built in function in COBOL which can increment A to B based on our call.

Thanks for your suggestion
Pravin
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7251

PostPosted: Wed Feb 27, 2013 4:10 pm    Post subject: Reply to: Alphanumeric sequence number
Reply with quote

I don't think you understood the example I gave.

ABCDEFGHIJKLMNOPQRSTUVWXYZ

The first letter in the table is the one you use first.

Once you've finished with a letter and it is the last in the table, you have a problem, deal with it.

Once you've finished with a letter, you use the letter after that one.

Yes, you have to "hard code" the alphabet, but now you can just paste from here (checking I've got it right, of course). Makes it "easy code".

Cobol is not a language replete with "functions". They are all listed in the language reference.

Why you'd expect a function to exist for such a simple task, I don't know.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Wed Feb 27, 2013 5:26 pm    Post subject:
Reply with quote

Quote:
So i was looking for any Built in function in COBOL which can increment A to B based on our call.
You can stop looking because such a function does not exist. YOU will have to do some work to implement a solution to your issue.
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: Wed Feb 27, 2013 8:11 pm    Post subject:
Reply with quote

Hello and welcome to the forum,

What has been done for many years is to create a callable subroutine that performs this "function".
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
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Sequence number add in SORT pshongal SYNCSORT 3 Fri Sep 02, 2016 3:32 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts GDG vsersion number change Raghu navaikulam JCL & VSAM 5 Fri May 27, 2016 4:49 pm


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