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
 

 

Cobol move statement with pic clause X(4)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Cobol move statement with pic clause X(4)
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: 3158
Location: Tucson AZ

PostPosted: Mon Apr 09, 2007 6:27 pm    Post subject:
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    Post subject:
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    Post subject:
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

Active Member


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

PostPosted: Tue Apr 10, 2007 5:31 pm    Post subject:
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    Post subject: Diff b/a move and compute
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: 686
Location: Earth

PostPosted: Fri Apr 13, 2007 5:27 pm    Post subject: Re: Cobol move statement with pic clause X(4)
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    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 SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm
No new posts Execute TSO ACF commands from COBOL-I... supreethi.srid TSO/ISPF 0 Tue Feb 21, 2017 5:19 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm
No new posts Mainframe Interview Questions CICS,CO... akshathan Mainframe Interview Questions 6 Thu Feb 09, 2017 6:38 pm
No new posts VALIDATE NULL VALUE IN DB2 CASE STATE... useit DB2 5 Thu Feb 09, 2017 4:34 pm


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