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
 

 

Is it possible to move PIC x(9) to pic X(7)

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

New User


Joined: 06 Aug 2007
Posts: 1
Location: Bangalore

PostPosted: Tue Oct 30, 2007 12:33 pm    Post subject: Is it possible to move PIC x(9) to pic X(7)
Reply with quote

Can I move value of variable of length 9 characters to variable of length 7.Only I want first 7 characters in final variable.If yes , then how?
Back to top
View user's profile Send private message

Aaru

Senior Member


Joined: 03 Jul 2007
Posts: 1288
Location: Chennai, India

PostPosted: Tue Oct 30, 2007 2:02 pm    Post subject: Reply to: Is it possible to move PIC x(9) to pic X(7)
Reply with quote

suvidha,

Quote:
I want first 7 characters in final variable.If yes , then how?



You can directly move the data from X(9) to X(7) as both the fields are declared as alphanumeric. The last two bytes would get truncated moving the first 7 characters to the X(7) field.

Even though this works, try using the reference modification technique.
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 743
Location: Germany

PostPosted: Tue Oct 30, 2007 2:20 pm    Post subject:
Reply with quote

Hi !

In details:

Field9 pic x(9)
Field7 pic x(7)

Pos pic s9(4) comp
Lng pic s9(4) comp

Dlm pic x(1) value '$'

move field9 to field7 ...simple & clear !!!

move field9 (1:7) to field7 ...a very little bit more transparent

move 1 to pos ...for making it of variable use
move 7 to lng

move field9 (pos:lng) to field7
move field9 (pos:lng) to field7 (pos:lng)

move dlm to field9 (8:1) ...for making it more confusing

string field9 delimited by dlm into field7
unstring field9 delimited by dlm into field7

Regards, UmeySan
Back to top
View user's profile Send private message
UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 743
Location: Germany

PostPosted: Tue Oct 30, 2007 2:49 pm    Post subject:
Reply with quote

Hi all !

That's why i posted it. Because six answers had been posted before mine
for solving this simple question. So i was leaded into temptation to put in my two cents.

Only YES and "move field9 to field7" could have been enougth.

@ enrico-sorichetti

Right, i agree! A link to the fine manual would have been a good hint.

Regards, UmeySan
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
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
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
This topic is locked: you cannot edit posts or make replies. Alphanumeric to Numeric move on UNIX mistah kurtz COBOL Programming 16 Wed Jul 27, 2016 8:47 pm
No new posts Need information on COBOL MOVE CORRES... subratarec COBOL Programming 10 Tue Jun 28, 2016 10:38 pm
No new posts how to move view the remote file in o... mailtoashok CICS 2 Fri Feb 12, 2016 1:07 pm


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