Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

display of comp-3 variable in readable format

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: display of comp-3 variable in readable format
Reply with quote

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

murmohk1

Senior Member


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

PostPosted: Fri Dec 21, 2007 1:59 pm    Post subject:
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    Post subject: Reply to: display of comp-3 variable in readable format
Reply with quote

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

Senior Member


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

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

surya,

Chech this -
http://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: 685
Location: Earth

PostPosted: Fri Dec 21, 2007 2:44 pm    Post subject:
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: 1439
Location: Bangalore,India

PostPosted: Fri Dec 21, 2007 2:48 pm    Post subject:
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    Post subject: Reply to: display of comp-3 variable in readable format
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: 685
Location: Earth

PostPosted: Fri Dec 21, 2007 3:39 pm    Post subject:
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    Post subject:
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: 685
Location: Earth

PostPosted: Fri Dec 21, 2007 5:28 pm    Post subject:
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: 356
Location: New York

PostPosted: Fri Dec 21, 2007 5:42 pm    Post subject:
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: 356
Location: New York

PostPosted: Fri Dec 21, 2007 5:43 pm    Post subject:
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    Post subject: Reply to: display of comp-3 variable in readable format
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    Post subject:
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    Post subject: Re: Reply to: display of comp-3 variable in readable format
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    Post subject: suggestedPIC
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    Post subject: Re: Reply to: display of comp-3 variable in readable format
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    Post subject:
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    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 Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm
This topic is locked: you cannot edit posts or make replies. output data in CSV Format janmejay DFSORT/ICETOOL 3 Sat Oct 15, 2016 2:16 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us