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
 
How to display COMP variable

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
veera
Warnings : 1

New User


Joined: 24 Nov 2004
Posts: 20
Location: chennai

PostPosted: Sat Nov 27, 2004 6:58 pm    Post subject: How to display COMP variable
Reply with quote

hello
any one plse tell me how to display comp values.
Back to top
View user's profile Send private message

mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Nov 28, 2004 10:31 am    Post subject:
Reply with quote

Hi Veera,

I'm not sure of what you want to do. If you have a COMP value that looks like X'10' in memory, do you want to display 10 or 16?
Back to top
View user's profile Send private message
veera
Warnings : 1

New User


Joined: 24 Nov 2004
Posts: 20
Location: chennai

PostPosted: Sun Nov 28, 2004 2:33 pm    Post subject:
Reply with quote

[quote="mmwife"]Hi Veera,

I'm not sure of what you want to do. If you have a COMP value that looks like X'10' in memory, do you want to display 10 or 16?[/quote]

hello,
is posible diplay comp-1,com-3.
take this example
77 a pic x(l0) comp-3 value '1234'
77 a pic x(l0) comp-1 value '5678'.
how above values displayed.

veera
Back to top
View user's profile Send private message
lramani

New User


Joined: 03 Nov 2004
Posts: 21
Location: NOIDA, India

PostPosted: Mon Nov 29, 2004 10:47 am    Post subject:
Reply with quote

Hi Veera,
First of all these fields would have pic in 9(10) and not X(10) as was in your example.

COMP-3 stores in packed decimal format and COMP-1 in Binary.

If u need to display them u need to move these to display field (which is the default) and then have a display done.

So for example u have

Field1 pic 9(10) COMP-3.
Field2 pic 9(10) COMP-1.

Move them to some field (field3) with just pic 9(10)...no comp. So that indicates its a display field.

Just have
DISPLAY FIELD3.

You could ofcourse DISPLAY field1 and field2 but its difficult to interpret what they are. Atleast in packed decimal format its easy cos generally the number displays with C or D at the end on the basis of its a postive or a negative number.

But still i would suggest u to have a display done by moving it to a display field.

In case if the COMP-3 field is going to ur file then u could read them by having a HEX ON done.
Back to top
View user's profile Send private message
veera
Warnings : 1

New User


Joined: 24 Nov 2004
Posts: 20
Location: chennai

PostPosted: Mon Nov 29, 2004 6:15 pm    Post subject:
Reply with quote

[quote="lramani"]Hi Veera,
First of all these fields would have pic in 9(10) and not X(10) as was in your example.

COMP-3 stores in packed decimal format and COMP-1 in Binary.

If u need to display them u need to move these to display field (which is the default) and then have a display done.

So for example u have

Field1 pic 9(10) COMP-3.
Field2 pic 9(10) COMP-1.

Move them to some field (field3) with just pic 9(10)...no comp. So that indicates its a display field.

Just have
DISPLAY FIELD3.

You could ofcourse DISPLAY field1 and field2 but its difficult to interpret what they are. Atleast in packed decimal format its easy cos generally the number displays with C or D at the end on the basis of its a postive or a negative number.

But still i would suggest u to have a display done by moving it to a display field.

In case if the COMP-3 field is going to ur file then u could read them by having a HEX ON done.[/quote]


thanks,
veera
one more thing how internal repsentation of comp,comp-3,if we
type hexa on tell with example.

veera
Back to top
View user's profile Send private message
lramani

New User


Joined: 03 Nov 2004
Posts: 21
Location: NOIDA, India

PostPosted: Tue Nov 30, 2004 10:29 am    Post subject:
Reply with quote

Hi Veera,

Regd how to read the HEX ON when its COMP-3 ..would surely tell u. But the best thing u could do is write a small program to experiment on ur own. That will put u in a better and clear place.

For instance a number +123 had been the value which was stored in COMP-3.

Do an HEX ON in the file. They will appear something like the below.

13
2C

Had it been -123 it would have appeared like

13
2D.

Had the number been +1234 it would have appeared as

024
13C.

I hope u got how to read them........
Back to top
View user's profile Send private message
jz1b0c

Active User


Joined: 25 Jan 2004
Posts: 160
Location: Toronto, Canada

PostPosted: Tue Nov 30, 2004 9:31 pm    Post subject:
Reply with quote

hi Ramani,

I guess you are confused between Comp-3 and hex

comp-3 is not hex its a packed decimal.

so 01 ws-cpm2 pic 9(10) value 12345.

it you display this field it will look like

0000012345.

1A,123D, These will come in hex decimal.
Back to top
View user's profile Send private message
lramani

New User


Joined: 03 Nov 2004
Posts: 21
Location: NOIDA, India

PostPosted: Wed Dec 01, 2004 9:45 am    Post subject:
Reply with quote

Hi jz1b0c,
I guess u got the wrong meaning of what i had explained him.

I had already explained about how to have the display. The one i had explained him was with regards to how we could read a comp-3 in a file using HEX ON.

To make it more clear....

for instance a FILE1 had a field which was defined as COMP-3 then they would be stored in half the storage space and one can not read it by just opening the file. they will appear something like ...@.. or something like ..# etc. We need to do a HEX ON and read them.

Veera had asked how to read by doing an HEX ON.

Sorry Veera and jz1b0c if i had confused you.
Back to top
View user's profile Send private message
Ravi gaur

New User


Joined: 12 Jul 2005
Posts: 38

PostPosted: Thu Oct 13, 2005 9:11 am    Post subject: Hi all
Reply with quote

This is my Program.
IDENTIFICATION DIVISION.
PROGRAM-ID. COMP3.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 A PIC 9(10) COMP-3 VALUE '1234'.
77 C PIC 9(10).
PROCEDURE DIVISION.
MAIN.
MOVE A TO C.
DISPLAY C.
STOP RUN.

getting this error

IGYGR1080-S A "VALUE" clause literal was not compatible with the data category of the subject data item. The "VALUE" clause was discarded.
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Thu Oct 13, 2005 11:07 am    Post subject:
Reply with quote

Try this:

IDENTIFICATION DIVISION.
PROGRAM-ID. COMP3.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 A PIC 9(10) COMP-3 VALUE '1234'.
77 C PIC 9(10).
PROCEDURE DIVISION.
MAIN.
MOVE A TO C.
DISPLAY C.
STOP RUN.


Dont use quotes with numeric values.
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Thu Oct 13, 2005 12:09 pm    Post subject:
Reply with quote

Sorry my mistake, the program must be:

IDENTIFICATION DIVISION.
PROGRAM-ID. COMP3.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
77 A PIC 9(10) COMP-3 VALUE 1234.
77 C PIC 9(10).
PROCEDURE DIVISION.
MAIN.
MOVE A TO C.
DISPLAY C.
STOP RUN.


Dont use quotes with numeric values.
Back to top
View user's profile Send private message
spk31980

New User


Joined: 08 Feb 2006
Posts: 6

PostPosted: Wed Feb 08, 2006 4:07 pm    Post subject: Re: how to display com values
Reply with quote

Comp fields cant be displayed it should be either moved to different variable or use the utility icetool to display it.
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 CONDITIONAL USING COMP-2 WITH PROBLEMS. JOSUEGENTIL COBOL Programming 7 Wed Nov 08, 2017 11:13 pm
No new posts how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
No new posts display the sign only if the value is... useit DFSORT/ICETOOL 3 Wed Oct 04, 2017 5:53 pm

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