Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

REDEFINES (Numeric to Alpha) - REG

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: REDEFINES (Numeric to Alpha) - REG
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

Active Member


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

PostPosted: Mon Oct 18, 2010 6:37 pm    Post subject:
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: 8057
Location: East Dubuque, Illinois, USA

PostPosted: Mon Oct 18, 2010 6:41 pm    Post subject:
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    Post subject:
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

Active Member


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

PostPosted: Mon Oct 18, 2010 6:55 pm    Post subject:
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    Post subject:
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    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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us