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

REDEFINES (Numeric to Alpha) - REG


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Mon Oct 18, 2010 6:34 pm
Reply with quote

Hi all,

Please look at the below code,
Code:

01  WS-SS-TYPE                  PIC S999  COMP VALUE +110.
01  WS-SST-REDEF                REDEFINES WS-SS-TYPE.     
    05  FILLER                  PIC X.                   
    05  WS-STOP-START-TYPE      PIC X.                   


What will be the value of 'WS-STOP-START-TYPE'?? and please explain how is it happening?

Please help.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Mon Oct 18, 2010 6:37 pm
Reply with quote

Here's how to find out.

1. Create a one record file with WS-SS-TYPE as you have defined it.
2. Browse/view/edit it.
3. Use the HEX ON primary command to see the hex value of each byte.
4. Let us know what you see, preferably by using the code tag as you have done.
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Mon Oct 18, 2010 6:41 pm
Reply with quote

If you review the EBCDIC collating sequence (hint: Google is your friend), you will find that X'6E' is a greater than (>) sign. If you display WS-STOP-START-TYPE you will see the > sign. WS-SS-TYPE has the value X'006E' (6 times 16 is 96 + 14 is 110) so the second byte will be X'6E'.
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Mon Oct 18, 2010 6:51 pm
Reply with quote

Robert,
Thank you so much for the help.
This is the answer i wanted.
X'006E', so the first two bytes('00' of 006E) goes to the filler and the '6E' goes to ws-stop-start type.

Phil,
Thanks for the effort & time.
Now i understand how to get these.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Mon Oct 18, 2010 6:55 pm
Reply with quote

Since you're using COMP (pure binary), try the windows calculator in scientific mode - type in decimal, switch to HEX.
Back to top
View user's profile Send private message
shankarm

Active User


Joined: 17 May 2010
Posts: 175
Location: India

PostPosted: Mon Oct 18, 2010 7:00 pm
Reply with quote

you are right Phil,
I have used scientific calculator and is working fine.
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Convert HEX to Numeric DB2 3
No new posts Find a record count/numeric is multip... COBOL Programming 1
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts Numeric check on packed signed and un... COBOL Programming 4
Search our Forums:

Back to Top