View previous topic :: View next topic
|
Author |
Message |
Abhishek Palo
New User
Joined: 04 Aug 2009 Posts: 7 Location: Mysore
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Abhishek Palo
New User
Joined: 04 Aug 2009 Posts: 7 Location: Mysore
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Abhishek Palo
New User
Joined: 04 Aug 2009 Posts: 7 Location: Mysore
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
Abhishek Palo
New User
Joined: 04 Aug 2009 Posts: 7 Location: Mysore
|
|
|
|
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 |
|
|
Abhishek Palo
New User
Joined: 04 Aug 2009 Posts: 7 Location: Mysore
|
|
|
|
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 |
|
|
Abhishek Palo
New User
Joined: 04 Aug 2009 Posts: 7 Location: Mysore
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Abhishek Palo
New User
Joined: 04 Aug 2009 Posts: 7 Location: Mysore
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
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 |
|
|
|