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

S9 COMP-3 and S9(5) displaying the same output in the spool!


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
HARLEEN SINGH MANN
Warnings : 2

New User


Joined: 03 Aug 2007
Posts: 17
Location: Pune

PostPosted: Fri Oct 19, 2007 6:31 pm
Reply with quote

my code is as follows:
-------------------------------------------------------------------------------
01 WW-1 PIC S9(5) USAGE IS COMP-3.
01 WW-2 PIC S9(5).
PROCEDURE DIVISION.
MOVE -123450 TO WW-1 WW-2
DISPLAY WW-1 WW-2
STOP RUN.
---------------------------------------------------------------------------
My confusion is that the display in the spool shows the same output for both.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Oct 19, 2007 7:15 pm
Reply with quote

Hello,

Yes, that is what it should do. . .

The values are stored differently internally, but when displayed, they should show the same value.
Back to top
View user's profile Send private message
HARLEEN SINGH MANN
Warnings : 2

New User


Joined: 03 Aug 2007
Posts: 17
Location: Pune

PostPosted: Fri Oct 19, 2007 10:54 pm
Reply with quote

Okay. take ur word on that. but tel me somethin: how can i see how the two fields are stored internally? should i write a file and see it in the file?


Also,

the value eg. MOVE -11110 TO WW-<COMP3VAR>
shows in SYSOUT after "hex on" as :-
FFFFD
11110

can you explain this please?

I know that D is for -ve but shouldn't it be D in the final nibble?
I am confused with that "hex on" feature.
can u or anyone throw some light.

thnks a lot
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Oct 19, 2007 11:17 pm
Reply with quote

Hello,

Quote:
how can i see how the two fields are stored internally? should i write a file and see it in the file?
Yes, if you write these into a file, you can then browse the file with HEX ON and see how they are stored internally.

Quote:
the value eg. MOVE -11110 TO WW-<COMP3VAR>
shows in SYSOUT after "hex on" as :-
FFFFD
11110
I'd suggest you write this field to the same field as the one mentioned above. If the field is defined as comp-3, yes, the D will be in the low-order nibble. If the field is s9(5) only, it will have the D in the high-order nibble of the low-order byte.

It will be well demonstrated if you define multiple fields in the same record (of different types) and look at all of them together in the same record with HEX ON.

HEX on works better when browsing a dataset - i don't use HEX ON in sysout.
Back to top
View user's profile Send private message
HARLEEN SINGH MANN
Warnings : 2

New User


Joined: 03 Aug 2007
Posts: 17
Location: Pune

PostPosted: Fri Oct 19, 2007 11:29 pm
Reply with quote

Ohhh. i am understanding now. I dont have mainframe access right now(Iam at home) but will see these after writing them into a file.

And for your info if u r not aware we can open the SYSOUT in SE mode instead of simply S to view it in editor mode. where we can use hex on.

One last question. How do i compile my codes like the one i want to now (writing into a file to see the diff) at home? is there a mainframe emulator/simulator available? how do i compile n run codes on my PC?

Thanks and regards,
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Oct 19, 2007 11:58 pm
Reply with quote

Hello,

I'd suggest you talk with your system support or networking people and have them tell what you need to connect to your mainframe from outside your workplace. You will probably need a 3270-emulator to run on your pc and you should be able to connect to the mainframe from your internet connection.

They should be able to tell you where to download the emulator they prefer to support and how to configure it.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Oct 21, 2007 10:09 pm
Reply with quote

Hi Harleen,

Another way to do it is to redefine the fields as PIC x and DISPLAY the PIC x names, not the numeric names. As I recall, because they are defined as A/N no data conversion is performed before DISPLAYing the data.

You'll still have to use HEX ON to view them in SYSOUT.
Back to top
View user's profile Send private message
HARLEEN SINGH MANN
Warnings : 2

New User


Joined: 03 Aug 2007
Posts: 17
Location: Pune

PostPosted: Mon Oct 22, 2007 12:52 am
Reply with quote

that a good advice i must say. i l try the moving the two fields to PIC X() and get back to u here.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


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

PostPosted: Mon Oct 22, 2007 3:17 am
Reply with quote

HARLEEN SINGH MANN wrote:
that a good advice i must say. i l try the moving the two fields to PIC X() and get back to u here.


No, redefine the comp-3 as a pic x( ) and display the pic x field.
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 TRIM everything from input, output co... DFSORT/ICETOOL 1
No new posts Sortjoin and Search for a String and ... DFSORT/ICETOOL 1
No new posts IBM OnDemand Folders displaying to al... IBM Tools 6
No new posts Joinkeys - 5 output files DFSORT/ICETOOL 7
No new posts Build a record in output file and rep... DFSORT/ICETOOL 11
Search our Forums:

Back to Top