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

Can i directly move S9(9) comp to S9(9) comp


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

New User


Joined: 21 Sep 2007
Posts: 6
Location: chennai

PostPosted: Tue Aug 12, 2008 10:27 am
Reply with quote

I am reteving a Curr_Date date field from table which is defind as S9(9) comp (ccyymmdd). I want to move this field to another working storage variable WS-DATE which is also a S9(9) comp field in the format 000yymmdd. so my small doubt is can i move it directly as

MOVE Curr_Date(3:6) TO WS-Date(4:6).

Whether it will work or not. I know it's a silly doubt but i had so much of date logic in this program, that i confused little bit. icon_sad.gif

Thanks in advance,
Sam
Back to top
View user's profile Send private message
Santoshdorge

New User


Joined: 27 Jun 2006
Posts: 48
Location: Pune

PostPosted: Tue Aug 12, 2008 11:15 am
Reply with quote

I have never seen reference modification used on comp variables.
I am under impression that this should be used for strings only. icon_biggrin.gif

Thanks,
Santosh.
Back to top
View user's profile Send private message
sam_duniya

New User


Joined: 21 Sep 2007
Posts: 6
Location: chennai

PostPosted: Tue Aug 12, 2008 11:24 am
Reply with quote

Can i have the other way of doing it..
Back to top
View user's profile Send private message
Santoshdorge

New User


Joined: 27 Jun 2006
Posts: 48
Location: Pune

PostPosted: Tue Aug 12, 2008 11:41 am
Reply with quote

Yes.

Move Curr_Date to the ws-variable with declaration of usage diaplay format of same size and then use reference modification on ws-variable.
Hope this helps you.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Aug 12, 2008 11:42 am
Reply with quote

move it to an S9(6) comp field.

the reference modification will not work because you need to move 3.5 bytes.

reference modification will work for any datatype. whether your results are correct or not depends upon the definitions and what you are trying to do.
Back to top
View user's profile Send private message
Santoshdorge

New User


Joined: 27 Jun 2006
Posts: 48
Location: Pune

PostPosted: Tue Aug 12, 2008 12:05 pm
Reply with quote

Dick,
I tried running reference modification on usage comp and comp-3 variableb but it;s giving me error compile time error.
here is the error
Code:

IGYPS2214-S   REFERENCE-MODIFIED DATA ITEM "D" WAS NOT DEFINED
WITH "USAGE DISPLAY", "USAGE DISPLAY-1"  OR "USAGE NATIONAL".
THE STATEMENT WAS DISCARDED.


maybe this had to do something with compiler options but as of now
i am on the side that we can use reference modification on usage display variables only.
Please correct me if I am wrong.

Thanks,
Santosh.
Back to top
View user's profile Send private message
CICS Guy

Senior Member


Joined: 18 Jul 2007
Posts: 2146
Location: At my coffee table

PostPosted: Tue Aug 12, 2008 12:26 pm
Reply with quote

data-name-1
Must reference a data item whose usage is DISPLAY, DISPLAY-1, or NATIONAL.
Data-name-1 can be qualified or subscripted. Data-name-1 cannot be a windowed date field.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


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

PostPosted: Tue Aug 12, 2008 12:35 pm
Reply with quote

Santosh,

Sorry, you are right.

I normally ref-mod on a group or redefined reference thus never encounter the compiler error. (or I did once and now automatically redefine fields that I will ref-mod).
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 COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Call program, directly from panel CLIST & REXX 9
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
Search our Forums:

Back to Top