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
 

 

Increment Character value say from A to B using Cobol pgm

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

New User


Joined: 21 Oct 2008
Posts: 2
Location: mumbai

PostPosted: Tue Oct 21, 2008 10:18 pm    Post subject: Increment Character value say from A to B using Cobol pgm
Reply with quote

Hi all,

Can anyone let me know is there any way to increment Character value.
For example If i want a value say B0 which should come after A9. Is there any way other than using working storage variables or hard coding these values in the program
Back to top
View user's profile Send private message

Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8055
Location: East Dubuque, Illinois, USA

PostPosted: Tue Oct 21, 2008 10:40 pm    Post subject:
Reply with quote

Define an array of the values you want and iterate over the array. And you're going to have to use WORKING-STORAGE items most likely, and may have to hard-code the values.

And what do B0 and A9 represent, anyway?
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Tue Oct 21, 2008 10:58 pm    Post subject: Re: Increment Character value say from A to B using Cobol pg
Reply with quote

If these values are 01-Byte HEX, then the next value after X'A9' is X'AA'.

To increment these values, define a PIC 9(08) BINARY field and then redefine it as PIC X(04), clear the BINARY field to ZERO then move the 01-Byte HEX value to the 4th-Byte of the PIC X(04) redefined BINARY field. Then, ADD 1 to the BINARY field and you've just increment your HEX value by one.

Is this what you want to do?

Bill
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 Oct 22, 2008 1:07 am    Post subject:
Reply with quote

Hello Uday and welcome to the forum,

What should come after Z9? Should the result value be something a user could enter/read or is it for internal use only?

If you explain your requirement in more detail, we can probably make better suggestions.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2502
Location: Atlanta, Georgia, USA

PostPosted: Wed Oct 22, 2008 1:16 am    Post subject: Re: Increment Character value say from A to B using Cobol
Reply with quote

Dick,

I believe IBM's got you on the Z9, it's a Z10 icon_wink.gif

Bill
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 Oct 22, 2008 1:35 am    Post subject: Reply to: Increment Character value say from A to B using Co
Reply with quote

Oh, pshaw. . .

I wasn't thinking of a hardware solution. . . icon_cool.gif

d
Back to top
View user's profile Send private message
udays51

New User


Joined: 21 Oct 2008
Posts: 2
Location: mumbai

PostPosted: Wed Oct 22, 2008 6:46 pm    Post subject:
Reply with quote

Thnaks,

the problem solved by using tables i rid it
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. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm
No new posts IMS T-Pipe queue counts in a COBOL Pr... Siva NKK Kothamasu IMS DB/DC 0 Tue May 09, 2017 6:31 pm
No new posts COBOL Code Parsers and Lineage Establ... balimanja COBOL Programming 2 Tue May 02, 2017 3:30 am
No new posts Cobol upgrade - source code missing f... gthmrj IBM Tools 1 Wed Apr 26, 2017 6:04 pm
No new posts COBOL Programming Sandpit? jodrisco COBOL Programming 6 Wed Apr 12, 2017 3:47 am


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