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

Comp3 to Alphanumeric


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

New User


Joined: 10 Feb 2009
Posts: 26
Location: chennai

PostPosted: Tue Feb 10, 2009 12:10 pm
Reply with quote

How to Move a S9(9) comp3 variable to X(6) variable

THis is need to retrieve the date in 'CCYYMMDD' format to MMDDYY format.
s9(9) comp 3 is of CCYYMMDD format and
X(6) should be in MMDDYY format
Back to top
View user's profile Send private message
Girish Firke

New User


Joined: 04 Feb 2009
Posts: 5
Location: Mumbai

PostPosted: Tue Feb 10, 2009 12:49 pm
Reply with quote

Hi Raki,

First move S9(9) comp-3 into 9(9) field-B.
Then you can move last 6 bytes of field-B to another field-C.
please see below example.

Working-storage section.
01 WS-A PIC S9(9) comp-3.
01 WS-B PIC 9(9).
01 WS-C PIC X(6).

PROCEDURE DIVISION.
MOVE WS-A TO WS-B.
MOVE WS-B(6:4) TO WS-C(1:4).
MOVE WS-B(4:2) TO WS-C(5:2).
GOBACK.




Thanks,
Girish icon_biggrin.gif
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 convert alphanumeric PIC X(02) to hex... COBOL Programming 3
No new posts Packed decimal to Alphanumeric COBOL Programming 2
No new posts Alphanumeric to Packed Decimal Conver... COBOL Programming 2
No new posts Move from Comp3 variable to Edited Va... COBOL Programming 7
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... COBOL Programming 10
Search our Forums:

Back to Top