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
 
Redefines and move statement

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

New User


Joined: 01 Apr 2005
Posts: 46

PostPosted: Fri Feb 23, 2007 12:10 pm    Post subject: Redefines and move statement
Reply with quote

Hi,

I have a doubt in redefines.
01 ws-name pic x(10)
01 ws-amt redefines ws-name pic 9(10).

Move ?500000? to ws-amt.
Display ws-name.
Display ws-amt.

What will be the values of ws-name and ws-pin

01 ws-name1 pic x(11) value ?kiran kumar?

Move 1 to ws-name1
Display ws-name1.

What will be the values of ws-name1.

Even though these are simple question, Please let me know the answer which I faced difficult.

Thanks & Regards,
Kiran
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Fri Feb 23, 2007 12:17 pm    Post subject:
Reply with quote

Hey,

Why dont u try to execute it rather than asking?
Back to top
View user's profile Send private message
raak

Active User


Joined: 23 May 2006
Posts: 166
Location: chennai

PostPosted: Fri Feb 23, 2007 12:30 pm    Post subject:
Reply with quote

For the first case, it l display 0000500000 for both ws-amt and ws-name, Since we r moving the value to 9(10) variable.
If u were moving it to the X(10) variable, u should get 500000.


in second case, it will display 1 only.. and that l be left aligned..



Tooo busy to try it out on ur mainfrmaes or what???
Back to top
View user's profile Send private message
prav_06
Warnings : 1

Active User


Joined: 13 Dec 2005
Posts: 154
Location: The Netherlands

PostPosted: Fri Feb 23, 2007 12:39 pm    Post subject:
Reply with quote

Raak and guptae,
What if kiran is learning mainframes in an institute and not getting enough time at the terminal to practice, so lets try to solve the person's problem even though its simple icon_biggrin.gif


Thamilzan.
Back to top
View user's profile Send private message
rajesh_mbt

New User


Joined: 27 Mar 2006
Posts: 95
Location: India

PostPosted: Fri Feb 23, 2007 12:46 pm    Post subject:
Reply with quote

Hi Kiran
You will get the result as Raak said in the above post.
Back to top
View user's profile Send private message
kiran_65

New User


Joined: 01 Apr 2005
Posts: 46

PostPosted: Fri Feb 23, 2007 12:50 pm    Post subject: Re: Redefines and move statement
Reply with quote

Hi All,

Thanks for the answer.

i tried in the office only.

i got the answer.

Thanks
Back to top
View user's profile Send private message
sachin_star3
Warnings : 1

New User


Joined: 30 Sep 2006
Posts: 78
Location: pune

PostPosted: Fri Feb 23, 2007 3:14 pm    Post subject:
Reply with quote

answer
1] you get result
0000500000
2] 1
kiran you not write syntax correctly
jusy
for fist case you write
Move 500000 to ws-amt. instead of
Move ?500000? to ws-amt.

and in second
Move '1' to ws-name1 instead of
Move 1 to ws-name1

i thnk this work for you
from-
sachin borase
ibm pune
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


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

PostPosted: Fri Feb 23, 2007 6:28 pm    Post subject:
Reply with quote

As Ekta says - why not test? The best way to really learn is to do it.
Back to top
View user's profile Send private message
Phrzby Phil

Active Member


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

PostPosted: Fri Feb 23, 2007 6:32 pm    Post subject:
Reply with quote

An additional comment please.

Even if your test time is limited, are you really going to code a production program a certain way with the justification that the code works because someone you do not even know says it works on a public unrefereed website?

Regardless of circumstances, you must own every detail of your product.
Back to top
View user's profile Send private message
khamarutheen

Active Member


Joined: 23 Aug 2005
Posts: 680
Location: NJ

PostPosted: Fri Feb 23, 2007 7:58 pm    Post subject: Cobol Program
Reply with quote

Code:
        IDENTIFICATION DIVISION.
        PROGRAM-ID. MVCHK.
        ENVIRONMENT DIVISION.
        WORKING-STORAGE SECTION.
        01 WKT-1 PIC X(10).
        01 WKT-2 REDEFINES WKT-1 PIC 9(10).
        77 NM PIC X(10) VALUE 'KBASDF'.
        PROCEDURE DIVISION.
        PARA1.
              DISPLAY " ".
              MOVE '51234' TO WKT-2.
              DISPLAY WKT-2.
              DISPLAY WKT-1.
              ADD 1 TO WKT-2.
              DISPLAY WKT-2.
              DISPLAY NM.
              MOVE "1" TO NM.
              DISPLAY NM.


Output ::
Quote:
0000051234
0000051234
0000051235
KBASDF
1


----
With Regards
K.A.Khamarutheen
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 WER268A OUTREC STATEMENT : SYNTAX E... frozenblood87 SYNCSORT 12 Sat Aug 26, 2017 9:45 pm
No new posts Suppress value reported by BREAK in D... Learncoholic DFSORT/ICETOOL 3 Wed Aug 16, 2017 6:03 pm
No new posts Move from Comp3 variable to Edited Va... sreekusr COBOL Programming 8 Thu Aug 10, 2017 4:20 pm
No new posts ON 2 AND EVERY 1 - Statement ??? UmeySan COBOL Programming 2 Tue Jul 25, 2017 1:20 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm

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