View previous topic :: View next topic
|
Author |
Message |
ABaluchamy
New User
Joined: 29 Dec 2006 Posts: 34 Location: INDIA
|
|
|
|
I have a comp-3 variable in a dataset..
While reading the file, the old read process read the entire file in to a alpha-numeric variable and now i have extract my comp-3 from that X variable
They don't want me change the traditional read process.
I have tried
CHAR -> COMP
CHAR-> NUMBER -> COMP
CHAR -> EDITED PIC -> COMP
But everything fails with S0C7.
Please help me out. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Arre you certain the value is a proper packed-decimal number? It may help if you post the value (in hex from a file view/browse) and the code moving the value from the record to some field within the program.
You should be able to simply redefine the data area and give the proper PIC for whatever size. . . |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
If the data in the file is really comp-3 data but is defined in the input file as character (you really should change the input record definition) then you would have to move it to the character data to another character field that is redefined as comp-3 then you can use the redefinition as a comp-3 field. As Dick suggests show us what is really in the file, there are too many misinterpretations of data on this board to continue without seeing the data. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
I'm confused ... you say
Quote: |
I have a comp-3 variable in a dataset. |
but then you go on to say you've tried
Quote: |
CHAR -> COMP
CHAR-> NUMBER -> COMP
CHAR -> EDITED PIC -> COMP |
Precision of terminology can be incredibly important in something like this. COMP-3 and COMP are not the same representations of data and interchanging the two will cause a S0C7 quite rapidly.
So ... are you dealing with a COMP-3 field or not? Post the hex value from at least one or two fields so we can determine what kind of data you've actually got. |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Quote: |
CHAR -> COMP
CHAR-> NUMBER -> COMP
CHAR -> EDITED PIC -> COMP |
File has COMP-3 values right? then why are you trying to move to COMP. You should redefine as suggested by many of the senior members.
Instead, if you have charactar data in the fields then use intrinsic function numeric for achieving this.
Code: |
MOVE FUNCTION NUMVAL (CHAR-FIELD) TO COMP-FIELD |
|
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello Anand,
Quote: |
Please help me out. |
For us to be able to help, you need to provide the requested info - the "real" data you are working with.
As you can see from your topic, people are trying to help you, but all we can do is guess until you show exactly what the data cointains. |
|
Back to top |
|
|
ABaluchamy
New User
Joined: 29 Dec 2006 Posts: 34 Location: INDIA
|
|
|
|
Hi,
REDEFINES works fine.. Thanks folks |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for the reply
d |
|
Back to top |
|
|
|