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

Cobol move statement with pic clause X(4)


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

New User


Joined: 08 Dec 2006
Posts: 12
Location: Kolkata

PostPosted: Mon Apr 09, 2007 6:20 pm
Reply with quote

i have a field FIELD1 with pic clause X(4) which is having the value 'ABCD'
now if i move 'XYZ' to FIELD1 what will be the displayed value of FIELD1?
XYZ or XYZD
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Apr 09, 2007 6:27 pm
Reply with quote

Character fields truncate trailing while numeric fields truncate leading (and trailing depending upon the decimal point alignment).
Character fields pad trailing spaces while numeric fields pad leading zeros (and trailing depending upon the decimal point alignment).
Result 'XYZb' where 'b' is a blank.
Back to top
View user's profile Send private message
vkphani

New User


Joined: 29 Oct 2003
Posts: 29

PostPosted: Mon Apr 09, 2007 6:41 pm
Reply with quote

XYZ
Back to top
View user's profile Send private message
dnreddy

New User


Joined: 08 Dec 2006
Posts: 8
Location: chennai

PostPosted: Tue Apr 10, 2007 1:08 pm
Reply with quote

Hi

output is : XYZ


One of the features of the MOVE verb is that it will pad a variable with spaces to the end if the value that is being moved into an alphanumeric field is too short to fill the field. This is convenient; it's almost always what you want. In the line MOVE "Hello" TO THE-MESSAGE, the first five characters of THE-MESSAGE are filled with Hello, and the remaining character positions are filled with spaces.
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


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

PostPosted: Tue Apr 10, 2007 5:31 pm
Reply with quote

You could not test this?
Back to top
View user's profile Send private message
rameshfoa

New User


Joined: 05 Apr 2007
Posts: 27
Location: chennai

PostPosted: Fri Apr 13, 2007 11:56 am
Reply with quote

there is a diff b/w move and assignment operator (=); MOVE will initialize the var and then moves value....whereas '=' will juz move as it is....so if you move "XYZ" using "="...the result wlll be XYZD...please check it..if u want
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Apr 13, 2007 5:27 pm
Reply with quote

Quote:
there is a diff b/w move and assignment operator (=); MOVE will initialize the var and then moves value....whereas '=' will juz move as it is....so if you move "XYZ" using "="...the result wlll be XYZD...please check it..if u want

What do you 'want to say' by this? Please make it clearer.
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 Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
No new posts Generate random number from range of ... COBOL Programming 3
Search our Forums:

Back to Top