View previous topic :: View next topic
|
Author |
Message |
surya anem
New User
Joined: 20 Dec 2007 Posts: 54 Location: Hyderabad
|
|
|
|
How do i display a comp-3 variable in readable format in COBOL |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
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 |
|
|
surya anem
New User
Joined: 20 Dec 2007 Posts: 54 Location: Hyderabad
|
|
|
|
in COBOL. |
|
Back to top |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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 |
|
|
murmohk1
Senior Member
Joined: 29 Jun 2006 Posts: 1436 Location: Bangalore,India
|
|
|
|
Abhijit,
Thanks for highlighting my error.
May be i missed out the 'display' word. Weekdend mood. Cant help it. |
|
Back to top |
|
|
surya anem
New User
Joined: 20 Dec 2007 Posts: 54 Location: Hyderabad
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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.. It was not intentional, I was deceived by name 'surya'. |
|
Back to top |
|
|
surya anem
New User
Joined: 20 Dec 2007 Posts: 54 Location: Hyderabad
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
-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 |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
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 |
|
|
ksk
Active User
Joined: 08 Jun 2006 Posts: 355 Location: New York
|
|
|
|
Hi, I forgot to mention one thing. I have defined Var1 and Var2 with PIC 5 as an example. |
|
Back to top |
|
|
Mohankalyan99
New User
Joined: 06 Apr 2005 Posts: 16
|
|
|
|
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 |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
Hi Kalyan,
How did you get the comp-3 data into the A variable? |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
sdsinfo
New User
Joined: 14 Jan 2008 Posts: 10 Location: bangalore
|
|
|
|
Hi , Surya
you move your data to s9(10)v99 , i will be successful.. |
|
Back to top |
|
|
ousep143
New User
Joined: 06 Oct 2007 Posts: 32 Location: India
|
|
|
|
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
|
|
Back to top |
|
|
Mohankalyan99
New User
Joined: 06 Apr 2005 Posts: 16
|
|
|
|
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 |
|
|
|