IBM MAINFRAME HELP & SUPPORT FORUMS
Technical Forums for IBM Mainframe Applications like COBOL, JCL, CICS, DB2, FileAid, DFSORT, Endevor, Xpediter, CoolGen, CA-7&11, AbendAid, IMS, IDMS, PL/I, MqSeries, SyncSort, Assembler, ChangeMan, Easytrieve, InterTest, REXX, CLIST etc...
 

how to display com values

THIS IS AN ARCHIVE FORUM: CLICK HERE TO GO TO THE ORIGINAL TOPIC

 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Mainframe COBOL
View previous topic :: View next topic  
Author Message
veera



Joined: 24 Nov 2004
Posts: 21
Location: chennai

Posted: Sat Nov 27, 2004 6:58 pm    Post subject: how to display com values  

hello
any one plse tell me how to display com values.
Back to top  
veera



Joined: 24 Nov 2004
Posts: 21
Location: chennai

Posted: Sat Nov 27, 2004 6:59 pm    Post subject: Re: how to display comp values  

[quote="veera"]hello
any one plse tell me how to display comp values.[/quote]
Back to top  
mmwife



Joined: 30 May 2003
Posts: 1508

Posted: Sun Nov 28, 2004 10:31 am    Post subject:  

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  
veera



Joined: 24 Nov 2004
Posts: 21
Location: chennai

Posted: Sun Nov 28, 2004 2:33 pm    Post subject:  

[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  
lramani



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

Posted: Mon Nov 29, 2004 10:47 am    Post subject:  

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  
veera



Joined: 24 Nov 2004
Posts: 21
Location: chennai

Posted: Mon Nov 29, 2004 6:15 pm    Post subject:  

[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  
lramani



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

Posted: Tue Nov 30, 2004 10:29 am    Post subject:  

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  
jz1b0c



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

Posted: Tue Nov 30, 2004 9:31 pm    Post subject:  

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  
lramani



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

Posted: Wed Dec 01, 2004 9:45 am    Post subject:  

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  
Ravi gaur



Joined: 12 Jul 2005
Posts: 44

Posted: Thu Oct 13, 2005 9:11 am    Post subject: Hi all  

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  
umeshkmrsh



Joined: 21 Sep 2005
Posts: 81
Location: India

Posted: Thu Oct 13, 2005 11:07 am    Post subject:  

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  
umeshkmrsh



Joined: 21 Sep 2005
Posts: 81
Location: India

Posted: Thu Oct 13, 2005 12:09 pm    Post subject:  

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  
spk31980



Joined: 08 Feb 2006
Posts: 6

Posted: Wed Feb 08, 2006 4:07 pm    Post subject: Re: how to display com values  

Comp fields cant be displayed it should be either moved to different variable or use the utility icetool to display it.
Back to top  
 
       IBMMAINFRAMES.com - IBM Mainframe Support Forums Index -> Mainframe COBOL
Page 1 of 1
THIS IS AN ARCIVE FORUM IN READ ONLY MODE. IF YOU WANT TO ASK YOUR DOUBTS USE THE ACTUAL FORUM