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
 

 

Moving of data from 9 (7) to9 (7) comp-3

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

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Sep 09, 2010 10:34 am    Post subject: Moving of data from 9 (7) to9 (7) comp-3
Reply with quote

Hi,

Could you please help me out here?

I am trying to move Moving of data from 9 (7) to9 (7) comp-3 with below code
Code:
01 WS-TODAYS-CYYMMDD-V3.             
   05 WS-TODAY-C-V3         PIC 9(1).
   05 WS-TODAY-YYMMDD-V3    PIC 9(6).


01 WS-FILE-DATE.                     
   05 WS-FILE-C             PIC 9(1).
   05 WS-FILE-YY            PIC 9(2).
   05 WS-FILE-MM            PIC 9(2).
   05 WS-FILE-DD            PIC 9(2).

10  WS-AAAAAAAA-DATE1   COMP-3      PIC 9(007) VALUE ZERO.
10  WS-AAAAAAAA-DATE2   COMP-3      PIC 9(007) VALUE ZERO.

MOVE WS-TODAYS-CYYMMDD-V3 TO WS-AAAAAAAA-DATE1
MOVE WS-FILE-DATE         TO WS-AAAAAAAA-DATE2


But data is not received to below fields, some junk is getting moved.

WS-AAAAAAAA-DATE1
WS-AAAAAAAA-DATE2
Back to top
View user's profile Send private message

Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Thu Sep 09, 2010 11:56 am    Post subject:
Reply with quote

Hi vicharapusrinu,
Quote:
some junk is getting moved.
Why do you think so ?
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Thu Sep 09, 2010 12:06 pm    Post subject:
Reply with quote

Code:
     05  WS-WORK23               PIC 9(06).               
     05  WS-WORK24               PIC 9(06) USAGE IS COMP-3.
*                                                         
 PROCEDURE DIVISION.                                       
*                                                         
 MAIN-LINE-PARA.                                           
*                                                         
     MOVE 090910                  TO WS-WORK23.           
     MOVE WS-WORK23               TO WS-WORK24.           
     DISPLAY WS-WORK24.                                   
     STOP RUN.                                             
*                                                         


Output
Code:
090910


Seems to be working fine for me ...
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Sep 09, 2010 12:19 pm    Post subject:
Reply with quote

Binop B,

Thanks for your quick response.

My piece of code is like this

Code:
  DISPLAY 'WS-TODAYS-CYYMMDD-V3' WS-TODAYS-CYYMMDD-V3 
  DISPLAY 'WS-FILE-DATE' WS-FILE-DATE                 
 MOVE WS-C3-V3L2           TO WS-S9ZK1531-DATE1       
 MOVE WS-FILE-DATE         TO WS-S9ZK1531-DATE2       
  DISPLAY 'WS-S9ZK1531-DATE1 'WS-S9ZK1531-DATE1       
  DISPLAY 'WS-S9ZK1531-DATE2 'WS-S9ZK1531-DATE2     


Before move statement the variable consists of

WS-TODAYS-CYYMMDD-V3:: 2100909
WS-FILE-DATE:: 2100514

After move statement

WS-S9ZK1531-DATE1:: 2 1 0
WS-S9ZK1531-DATE2:: 2 1 0

But I am expecting

WS-S9ZK1531-DATE1::2100909
WS-S9ZK1531-DATE2::2100514
Back to top
View user's profile Send private message
vicharapusrinu
Warnings : 1

New User


Joined: 04 Dec 2006
Posts: 63
Location: Hyderabad

PostPosted: Thu Sep 09, 2010 12:26 pm    Post subject:
Reply with quote

Sorry
My piece of code is like this
Code:
  DISPLAY 'WS-TODAYS-CYYMMDD-V3' WS-TODAYS-CYYMMDD-V3 
  DISPLAY 'WS-FILE-DATE' WS-FILE-DATE                 
 MOVE WS-TODAYS-CYYMMDD-V3 TO WS-S9ZK1531-DATE1 ------change       
 MOVE WS-FILE-DATE         TO WS-S9ZK1531-DATE2       
  DISPLAY 'WS-S9ZK1531-DATE1 'WS-S9ZK1531-DATE1       
  DISPLAY 'WS-S9ZK1531-DATE2 'WS-S9ZK1531-DATE2
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Thu Sep 09, 2010 12:31 pm    Post subject:
Reply with quote

Code:
01 WS-FILE-DATE.                     
   05 WS-FILE-C             PIC 9(1).
   05 WS-FILE-YY            PIC 9(2).
   05 WS-FILE-MM            PIC 9(2).
   05 WS-FILE-DD            PIC 9(2).
01 WS-FILE-DATE-R           REDEFINES WS-FILE-DATE
                            PIC 9(7).
and use WS-FILE-DATE-R instead of WS-FILE-DATE.

Am leaving reasoning behind this to be found out by you... icon_wink.gif
Back to top
View user's profile Send private message
BhavaniV

New User


Joined: 23 Aug 2010
Posts: 5
Location: Chennai

PostPosted: Thu Sep 09, 2010 3:12 pm    Post subject:
Reply with quote

I think the reason is as follows:

The group variable declared would be considered as X(07).

So while moving, it would not be possible to move it to a COMP-3 variable.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Thu Sep 09, 2010 7:06 pm    Post subject:
Reply with quote

Hi BhavaniV,
Quote:
So while moving, it would not be possible to move it to a COMP-3 variable.
I wouldn't necessarily term it as "not possible" as the OP's post clearly depicts that the MOVE statement will work though not as expected... icon_smile.gif ... But yeah... the reason is because the variable will be considered as AlphaNumeric.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Sep 09, 2010 7:23 pm    Post subject:
Reply with quote

You can move to a comp-3 variable but you can not do a group move like you are trying. In COBOL there is a big difference between group moves and elementary item moves. You need to read the cobol language reference.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Fri Sep 10, 2010 5:08 am    Post subject:
Reply with quote

Hi,

REDEFINE WS-TODAYS-CYYMMDD-V3 and WS-FILE-DATE as PIC 9(7) and MOVE them to your receiving fields.
Back to top
View user's profile Send private message
Kurt Deininger

New User


Joined: 13 Jul 2010
Posts: 19
Location: Frankfurt/Germany

PostPosted: Fri Sep 10, 2010 2:36 pm    Post subject:
Reply with quote

For example like that:

Code:

01 WS-TODAYS-CYYMMDD-V3.             
   05 WS-TODAY-C-V3         PIC 9(1).
   05 WS-TODAY-YYMMDD-V3    PIC 9(6).
01 WS-TODAYS-CYYMMDD-V3-RED REDEFINES
    WS-TODAYS-CYYMMDD-V3 PIC 9(7).             


01 WS-FILE-DATE.                     
   05 WS-FILE-C             PIC 9(1).
   05 WS-FILE-YY            PIC 9(2).
   05 WS-FILE-MM            PIC 9(2).
   05 WS-FILE-DD            PIC 9(2).
01 WS-FILE-DATE-RED     REDEFINES
   WS-FILE-DATE PIC 9(7).                     

10  WS-AAAAAAAA-DATE1   COMP-3      PIC 9(007) VALUE ZERO.
10  WS-AAAAAAAA-DATE2   COMP-3      PIC 9(007) VALUE ZERO.

MOVE WS-TODAYS-CYYMMDD-V3-RED TO WS-AAAAAAAA-DATE1
MOVE WS-FILE-DATE-RED         TO WS-AAAAAAAA-DATE2


Cheers. Kurt
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Sat Sep 11, 2010 1:29 am    Post subject:
Reply with quote

BhavaniV wrote:
I think the reason is as follows:

The group variable declared would be considered as X(07).

So while moving, it would not be possible to move it to a COMP-3 variable.

The group variable will not be considered as some specific type. Cobol simply does no type conversions when doing a group move, that's why!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7905
Location: Bellevue, IA

PostPosted: Sat Sep 11, 2010 4:21 am    Post subject:
Reply with quote

Kjeld, from the COBOL Language Reference manual section 6.2.24.3:
Quote:
A group move is treated as though it were an alphanumeric-to-alphanumeric elementary move, except that there is no conversion of data from one form of internal representation to another. In a group move, the receiving area is filled without consideration for the individual elementary items contained within either the sending area or the receiving area, except as noted in the OCCURS clause.
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Mon Sep 13, 2010 1:20 pm    Post subject:
Reply with quote

Thanks for clarifying, Robert, the manual states it clearly icon_smile.gif .
Back to top
View user's profile Send private message
BhavaniV

New User


Joined: 23 Aug 2010
Posts: 5
Location: Chennai

PostPosted: Mon Sep 13, 2010 5:32 pm    Post subject:
Reply with quote

Thanks
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 ODPP(Optim Data privacy Provider) Iss... Rama kishore IBM Tools 1 Mon Nov 07, 2016 5:46 pm
No new posts Can sending 5 MB data between cobol p... Kevin Vaz CICS 12 Tue Oct 18, 2016 4:50 pm
No new posts Protection Exception while move 0 to ... Kevin Vaz CICS 10 Tue Oct 18, 2016 4:19 pm
No new posts output data in CSV Format janmejay COBOL Programming 8 Sat Oct 15, 2016 2:20 pm
This topic is locked: you cannot edit posts or make replies. output data in CSV Format janmejay DFSORT/ICETOOL 3 Sat Oct 15, 2016 2:16 pm


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