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
 

 

How to Move Binary value to a particular variable in COBOL

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

New User


Joined: 04 Aug 2009
Posts: 7
Location: Mysore

PostPosted: Tue Aug 04, 2009 2:38 pm    Post subject: How to Move Binary value to a particular variable in COBOL
Reply with quote

Hi,

I have got to move the Binary Value to a COBOL variable. Supposedly, when we want to move hexadecimal value directly, we have an option like MOVE X "FA1FA2FA3FA4" to WS-ALPHA. Likewise, is anything available to move BINARY values.
Back to top
View user's profile Send private message

dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 04, 2009 2:57 pm    Post subject:
Reply with quote

if you move x to x, there will be no conversion.

what 'exactly' do you want to do? speaking in generalities will not produce an answer.
Back to top
View user's profile Send private message
Abhishek Palo

New User


Joined: 04 Aug 2009
Posts: 7
Location: Mysore

PostPosted: Tue Aug 04, 2009 3:19 pm    Post subject:
Reply with quote

Hi,

We have a numeric field which is used in the packed decimal format in one set of applications (COMP-3 definition). We are now looking at converting the numeric field to alpha numeric, but trying to keep the packed decimal format intact .

So for the above reason, i was trying to convert the value into hexadecimal or binary value and then move it.

Kindly suggest a viable option.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 04, 2009 4:17 pm    Post subject:
Reply with quote

Quote:
We are now looking at converting the numeric field to alpha numeric, but trying to keep the packed decimal format intact .


why? you'all should rethink what you are trying to do.
This kind of rookie crap will get you into trouble.
Back to top
View user's profile Send private message
Abhishek Palo

New User


Joined: 04 Aug 2009
Posts: 7
Location: Mysore

PostPosted: Tue Aug 04, 2009 4:34 pm    Post subject:
Reply with quote

Sir,

Atleast to proove them wrong i need to have something substantial in hand. I am thinking of letting them know that it is not possible, but some said that try moving Binary values and get me a screenshot of that. SO i am working on it. It would really be helpful if someone can get me out of this mess.

In any case i want to know if I can move binary values to the cobol variables. If yes, then how and if NO, its OK.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 04, 2009 4:40 pm    Post subject:
Reply with quote

Abhishek Palo,
never did answer my question - why do you want to change the datatype?

what is wrong with packed-decimal?

there are all kinds of things you can do.
there are plenty of idiot sites out there that store numeric data in alphanumeric fields.

what are you trying to accomplish? why?????

give us the answers to those questions and i am sure many solutions will follow.
Back to top
View user's profile Send private message
Abhishek Palo

New User


Joined: 04 Aug 2009
Posts: 7
Location: Mysore

PostPosted: Tue Aug 04, 2009 4:59 pm    Post subject:
Reply with quote

Fine,

Sir, let me then find out this from my client and let you know at the earliest. But Kudos to your patience for ensuring that I should know why I am doing this. Hatss off.
Back to top
View user's profile Send private message
Abhishek Palo

New User


Joined: 04 Aug 2009
Posts: 7
Location: Mysore

PostPosted: Tue Aug 04, 2009 5:09 pm    Post subject:
Reply with quote

Sir,
Below are some more pointers.

Currently the client is using a X byte numeric field as a unique identifier. But soon they will run out of options. They have 2 options – one, expand the field from X to Y bytes. 2nd option – convert numeric field to alpha numeric, so that more unique identifiers are available without having to expand the field.
We are currently exploring the 2nd option.

Let me know if you need further details.
Back to top
View user's profile Send private message
Abhishek Palo

New User


Joined: 04 Aug 2009
Posts: 7
Location: Mysore

PostPosted: Tue Aug 04, 2009 5:34 pm    Post subject:
Reply with quote

Sir,

In my program, i have to 9(4) COMP-3 as my primary key, but soon i will run out of options. So i need to either change it to 9(5) or make it X(4) so that i increase my number of unique identifiers.

Cuurently, i am trying to explore the second option. So kindly pool in your suggestions.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Aug 04, 2009 6:43 pm    Post subject:
Reply with quote

If the data is stored in a file or database somewhere, you need to create a conversion process to be run one time to convert the data from COMP-3 to binary. Using a PIC S9(09) COMP (or COMP-5) field uses 4 bytes and greatly increases the number of unique values that can be stored. However, the bit patterns are different hence the conversion process is needed.
Back to top
View user's profile Send private message
Abhishek Palo

New User


Joined: 04 Aug 2009
Posts: 7
Location: Mysore

PostPosted: Tue Aug 04, 2009 7:25 pm    Post subject:
Reply with quote

Hi,

Is there any specific conversion process. I guess i need to do an impact analysis and then go ahead and do the conversions manually. But ya , please let me know if there is any other way out as i want to avoid the converison of number of bytes.

Robert, could you please elaborate a bit more about the conversion to S9(09) COMP. It may prove very helpfull to me.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


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

PostPosted: Tue Aug 04, 2009 7:47 pm    Post subject:
Reply with quote

I think your time would be better spent in the COBOL Language Reference manual (link at the top of the page) finding out the specifics of how bits are used in COMP-3 and COMP fields, rather than having me doing the same.
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: Tue Aug 04, 2009 8:50 pm    Post subject:
Reply with quote

Hello,

Quote:
In my program, i have to 9(4) COMP-3 as my primary key
Primary key to what? 9(4) comp-3 doesn't really accomplish anything except limit the value to 9999. A 9(5) comp-3 picture should occupy the same space/storage and allow a value up to 99999. They both require 3 bytes.

How long has the 9(4) size been sufficient? 9(5) may be all that is needed.

All of the screens and reports would need to be modified to handle the expansion, but that would be far less effort than changing the format of the data everywhere it resides. . .

Suggest it is at least worth an experiment. . .
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Aug 04, 2009 9:14 pm    Post subject:
Reply with quote

Quote:
Suggest it is at least worth an experiment. . .


unless of course, someone already has a solution and only wants to implement 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
No new posts How to move a long alphanumeric data ... lind sh COBOL Programming 6 Mon Dec 05, 2016 7:51 pm
This topic is locked: you cannot edit posts or make replies. RANDOM Function in COBOL swapnil781 COBOL Programming 2 Tue Nov 15, 2016 6:17 pm
No new posts Regarding COBOL Stored Procedure opti... selvamsrinivasan85 DB2 4 Fri Nov 04, 2016 8:57 pm
No new posts COBOL Version 6.1 Virendra Shambharkar COBOL Programming 5 Tue Nov 01, 2016 11:24 am
No new posts Cobol list of programs being called biswajit.dattagupta COBOL Programming 5 Tue Nov 01, 2016 2:10 am


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