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

Regarding move of X(2) varaible to X(200)


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

New User


Joined: 21 Sep 2009
Posts: 55
Location: Kolkatta

PostPosted: Tue Apr 27, 2010 3:14 pm
Reply with quote

Hi,

Below is my requrement

01 A PIC X(2) Value '**'.
01 B PIC X(100).

Now my requirement is without intializing our without movement
varable A whose pic clause contain X(2) value ** will also move all
value and B value display like this *************************************************

I think it possible with redifine can any one help to guide me how i solve throu redefine.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Apr 27, 2010 4:17 pm
Reply with quote

Hi Santhosh,

have you tried the usage of VALUE ALL while declaring the variable.
Back to top
View user's profile Send private message
smijoss

Active User


Joined: 30 Aug 2007
Posts: 114
Location: pune

PostPosted: Tue Apr 27, 2010 4:20 pm
Reply with quote

01 B pic x(100) value all '*'.

this will fill B with *.
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: Tue Apr 27, 2010 4:30 pm
Reply with quote

Quote:
I think it possible with redifine can any one help to guide me how i solve throu redefine.
You think wrong. You can use VALUE ALL '*' for the definition of B, but there is no way to use a REDEFINES clause to achieve what you are wanting.
Back to top
View user's profile Send private message
Bill O'Boyle

CICS Moderator


Joined: 14 Jan 2008
Posts: 2501
Location: Atlanta, Georgia, USA

PostPosted: Tue Apr 27, 2010 4:48 pm
Reply with quote

The only way I can see this working is -

Code:

01  B PIC  X(100) VALUE ALL '*'.
01  FILLER REDEFINES B.
    03  A PIC X(02).
    03  FILLER PIC X(98).

Variable A will equal '**'.

Bill
Back to top
View user's profile Send private message
santosh100678

New User


Joined: 21 Sep 2009
Posts: 55
Location: Kolkatta

PostPosted: Tue Apr 27, 2010 4:51 pm
Reply with quote

Hi,

Requirement is 01A PIC X(2) value '**'
Now second variable is 01 B PIC X(100)
restriction is that without using intilization variable or move statement
the value of a store into B with all 100 picture clause
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Apr 27, 2010 4:56 pm
Reply with quote

Quote:
restriction is that without using intilization variable or move statement
icon_question.gif icon_question.gif can u tell us why you are "restricted". ... icon_rolleyes.gif
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: Tue Apr 27, 2010 4:56 pm
Reply with quote

Quote:
Requirement is 01A PIC X(2) value '**'
Now second variable is 01 B PIC X(100)
restriction is that without using intilization variable or move statement
the value of a store into B with all 100 picture clause
Your requirement cannot be satisfied. Initialization or MOVE is required to do this. How many times will we have to tell you before you understand this?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Tue Apr 27, 2010 5:15 pm
Reply with quote

Quote:
...without movement
varable A whose pic clause contain X(2) value ** will also move...



without movement ... will also move

what kind of stupidity is this?

[START PERSONAL OPINION]

what a useless question.

[END PERSONAL OPINION]
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: Tue Apr 27, 2010 5:32 pm
Reply with quote

Quote:
what kind of stupidity is this?
It's crazy talk, Dick, that's what it is! icon_smile.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Apr 27, 2010 5:48 pm
Reply with quote

Why is there a restriction on what you can or cannot use to achieve the goal.
Who was stupid enough to post this restriction.

Is this an interview / homework question.
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: Tue Apr 27, 2010 9:27 pm
Reply with quote

Hello,

Quote:
Is this an interview / homework question.
Most likely - and a fairly meaningless one at that - as posted. . .

Possibly the interviewer asked something similar and this is what made it to the forum. . .

Once upon a time one could propogate the *'s by using something like the following. . .

Code:
01  B. 
    03  FILLER PIC X(02) VALUE '**'.
    03  A      PIC X(98).

    MOVE B TO A.


This worked due to the way the mvc was processed internally. . .

Actually, only 1 * was needed. . .
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 COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts How to move DB2 Installation HLQ DB2 4
No new posts How to move values from single dimens... COBOL Programming 1
No new posts Reading the CSV data in COBOL and mov... COBOL Programming 4
Search our Forums:

Back to Top