Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Reading COMP-3 variable from alpha numeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Reading COMP-3 variable from alpha numeric
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

Site Director


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

PostPosted: Tue Nov 25, 2008 6:41 am    Post subject:
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    Post subject:
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: 8153
Location: East Dubuque, Illinois, USA

PostPosted: Tue Nov 25, 2008 9:59 am    Post subject:
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: 686
Location: Earth

PostPosted: Tue Nov 25, 2008 12:48 pm    Post subject:
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

Site Director


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

PostPosted: Tue Nov 25, 2008 10:09 pm    Post subject:
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    Post subject: Reply to: Reading COMP-3 variable from alpha numeric
Reply with quote

Hi,

REDEFINES works fine.. Thanks folks
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 Nov 26, 2008 1:35 am    Post subject: Reply to: Reading COMP-3 variable from alpha numeric
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    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 Moving values to a variable of copybo... Vignesh Sid COBOL Programming 6 Wed Sep 06, 2017 1:04 pm
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Updating the Trailer count in variabl... satheshbabur DFSORT/ICETOOL 6 Wed Aug 30, 2017 9:49 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us