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

Convert COMP-3 into readable format


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

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Fri Dec 21, 2007 1:55 pm
Reply with quote

How do i display a comp-3 variable in readable format in COBOL
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Dec 21, 2007 1:59 pm
Reply with quote

Surya,

Quote:
How do i display a comp-3 variable in readable format

How do you want ot do it? With COBOL or Utils?
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Fri Dec 21, 2007 2:35 pm
Reply with quote

in COBOL.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Dec 21, 2007 2:39 pm
Reply with quote

surya,

Chech this -
www.ibmmainframes.com/viewtopic.php?t=26892&highlight=readable
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Dec 21, 2007 2:44 pm
Reply with quote

Have you tried DISPLAY statement? What was the result?
If not how about trying it and let us know about it..?
Murali,
The link you provided is to convert COMP-3 to DISPLAY I guess. If I got his question correctly, then DISPLAY stmt should help him achieving what he wanted.
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Fri Dec 21, 2007 2:48 pm
Reply with quote

Abhijit,

Thanks for highlighting my error.

May be i missed out the 'display' word. Weekdend mood. Cant help it.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Fri Dec 21, 2007 3:15 pm
Reply with quote

Yeah i tried that. But it was not displaying the sign if i have one.

ex: if the input is -40 it is not displaying. How to do that.
I tried to move that to edited picture clause +s9(4) but it was giving an s0c7 abend.

And one more thing it is not HE it is SHE
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Dec 21, 2007 3:39 pm
Reply with quote

Ok. COMP-3 sign will be last nibble that is why you are facing problem.

See the below table to interpret values -

Code:
-ve:           }JKLMNOPQR
                  0123456789
+ve            {ABCDEFGHI


Or you want the sign to be displayed in SYSOUT then use edit mask field as
01 TEMP PIC -9(05).
Move your var to TEMP and display TEMP.
Quote:
And one more thing it is not HE it is SHE

My apologies for that.. icon_smile.gif It was not intentional, I was deceived by name 'surya'.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Fri Dec 21, 2007 3:43 pm
Reply with quote

That is what i did and i got an SOC7 abend when i am trying to move that comp-3 variable to edited pic clause -s9(4).

And thats ok...it was not your mistake abt the name
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Dec 21, 2007 5:28 pm
Reply with quote

-s9(4) is not a valid picture clause change it to -9(04). First I had thought it was a typo in your post.
And I don't think you will get S0C7 on move statement.
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Fri Dec 21, 2007 5:42 pm
Reply with quote

Hi Surya,

Declare as hsown below.

01 VAR1 PIC S9(05) COMP-3.
01 VAR2 PIC -9(05).


and MOVE Var1 to var2. Sign also will be displayed in VAR2.

KSK
Back to top
View user's profile Send private message
ksk

Active User


Joined: 08 Jun 2006
Posts: 355
Location: New York

PostPosted: Fri Dec 21, 2007 5:43 pm
Reply with quote

Hi, I forgot to mention one thing. I have defined Var1 and Var2 with PIC 5 as an example.
Back to top
View user's profile Send private message
Mohankalyan99

New User


Joined: 06 Apr 2005
Posts: 16

PostPosted: Wed Jan 16, 2008 4:06 am
Reply with quote

Hi,

I tried to display comp-3 var, but it is failing.

here is my flow:

A PIC S9(10)V99 COMP-3
B PIC -9(10)V99.

MOVE A TO B
DISPLAY B.

It is not displaying anything. it is giving SOC7.
And before doing this i displayed the comp-3 var directly as DISPLAY A.
It displayed like this :000004040404.

Can you suggest how can i display that variable.

Thanks
Kalyan.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Wed Jan 16, 2008 4:49 am
Reply with quote

Hi Kalyan,

How did you get the comp-3 data into the A variable?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Wed Jan 16, 2008 4:52 am
Reply with quote

Mohankalyan99 wrote:
Hi,

I tried to display comp-3 var, but it is failing.

here is my flow:

A PIC S9(10)V99 COMP-3
B PIC -9(10)V99.

MOVE A TO B
DISPLAY B.

It is not displaying anything. it is giving SOC7.
And before doing this i displayed the comp-3 var directly as DISPLAY A.
It displayed like this :000004040404.

Can you suggest how can i display that variable.

Thanks
Kalyan.


It is not a valid comp-3 value!
Back to top
View user's profile Send private message
sdsinfo

New User


Joined: 14 Jan 2008
Posts: 10
Location: bangalore

PostPosted: Wed Jan 16, 2008 12:35 pm
Reply with quote

Hi , Surya

you move your data to s9(10)v99 , i will be successful..
Back to top
View user's profile Send private message
ousep143

New User


Joined: 06 Oct 2007
Posts: 32
Location: India

PostPosted: Wed Jan 16, 2008 12:54 pm
Reply with quote

Hi
if u get '000004040404' on comp-3 variable,no value in that variable.
first u manually move data into the comp-3 variable and try it.Ok

Regards
icon_smile.gif
Back to top
View user's profile Send private message
Mohankalyan99

New User


Joined: 06 Apr 2005
Posts: 16

PostPosted: Wed Jan 16, 2008 7:50 pm
Reply with quote

I received comp-3 data in a file and i'm trying to read that and insert into a table.

One more point, Can this be possible moving the data from a S9(10)V99 comp-3 variable to a S9(07)V99 comp-3 variable ?

Thanks
Kalyan
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 Populate last day of the Month in MMD... SYNCSORT 2
No new posts Modifying Date Format Using DFSORT DFSORT/ICETOOL 9
No new posts Need to convert date format DFSORT/ICETOOL 20
No new posts Keep leading zero(s) after convert fl... SYNCSORT 7
No new posts InfoSphere OPTIM CSV ouput vs DSNTIUA... IBM Tools 3
Search our Forums:

Back to Top