IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reading COMP-3 variable from alpha numeric


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
ABaluchamy

New User


Joined: 29 Dec 2006
Posts: 34
Location: INDIA

PostPosted: Tue Nov 25, 2008 6:29 am
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 25, 2008 6:41 am
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Tue Nov 25, 2008 7:00 am
Reply with quote

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
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Tue Nov 25, 2008 9:59 am
Reply with quote

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
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Tue Nov 25, 2008 12:48 pm
Reply with quote

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
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Nov 25, 2008 10:09 pm
Reply with quote

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
View user's profile Send private message
ABaluchamy

New User


Joined: 29 Dec 2006
Posts: 34
Location: INDIA

PostPosted: Tue Nov 25, 2008 10:15 pm
Reply with quote

Hi,

REDEFINES works fine.. Thanks folks
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Wed Nov 26, 2008 1:35 am
Reply with quote

Good to hear it is working - thank you for the reply icon_smile.gif

d
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Reading dataset in Python - New Line ... All Other Mainframe Topics 22
No new posts Find the size of a PS file before rea... COBOL Programming 13
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
Search our Forums:

Back to Top