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
 

 

move statemnt (overflow)

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
sjiraga

New User


Joined: 20 Apr 2009
Posts: 14
Location: Bangalore

PostPosted: Tue May 26, 2009 11:14 am    Post subject: move statemnt (overflow)
Reply with quote

Hi I have question with COBOL move statement (TRUNCATE PROBLEM)

VAR1 PIC X (10)
VAR2 PIC X (07)

In my Program I am moving VAR1 TO VAR2 while moving truncation will happen. Now I want to know how to add the logic for data truncation in my COBOL program.
If I move VAR1 TO VAR2 program should run but it should display only error message so please let me know what is the logic. One more thing I don't want to use string option or I cant change size of PIC. Please if anyone know the logic let me know....
Back to top
View user's profile Send private message

ksk

Active User


Joined: 08 Jun 2006
Posts: 356
Location: New York

PostPosted: Tue May 26, 2009 11:42 am    Post subject:
Reply with quote

Count the number of characters in VAR1 and VAR2 using inline perform as you don't want to use string.

If VAR1 is greater than VAR2, display the error message. Otherwise move the contents.
Back to top
View user's profile Send private message
sjiraga

New User


Joined: 20 Apr 2009
Posts: 14
Location: Bangalore

PostPosted: Tue May 26, 2009 2:12 pm    Post subject: Reply to: move statemnt (overflow)
Reply with quote

Thanks a lot ksk
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue May 26, 2009 5:01 pm    Post subject:
Reply with quote

Sounds like class work, since the STRING option is out.
Back to top
View user's profile Send private message
Succor

New User


Joined: 20 Feb 2009
Posts: 96
Location: Bangalore :)

PostPosted: Tue May 26, 2009 7:28 pm    Post subject: Reply to: move statemnt (overflow)
Reply with quote

sjiraga, In case you dont wish to use the STRING statement you might try the following logic :
Code:
 IF VAR1(8:3) = SPACES
         MOVE THE VARIBALES
 ELSE
         DISPLAY THE ERROR
 END-IF.

WTH
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 8 Wed Jan 25, 2017 8:24 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:23 pm
No new posts DB2 9.1.0 not move values to Host-Var... Miguel Fernandez DB2 0 Wed Jan 25, 2017 8:21 pm
No new posts ESQA overflow - high ECSA utilization vasanthz All Other Mainframe Topics 1 Thu Dec 29, 2016 7:06 am
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm


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