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

Comp3 Move


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

New User


Joined: 19 Jul 2010
Posts: 21
Location: Chennai

PostPosted: Thu Nov 11, 2010 6:53 pm
Reply with quote

Hi ,

I know this might be asked several times , But I am looking for pointers in this forum for my query.

Here is the requirement.

05 RJ-EFF-DATE PIC S9(7) COMP-3.

This needs to be moved to new field
05 RJ1-EFF-DATE PIC S9(5) COMP-3.

I am moving field1 to Field2 truncation would accur , I need to avoid this.

Please advise for any pointers which are already posted in this forum.


Thanks
Job1919
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Thu Nov 11, 2010 7:31 pm
Reply with quote

If you are moving a 7-byte number to a 5-byte number, and the absolute value of the 7-byte number is more than 99,999 then you cannot avoid truncation. Your code can test for values that would cause truncation and do something about it -- but what you do depends upon the system and needs to be under the direction of your team leader or manager, not us.
Back to top
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Thu Nov 11, 2010 8:28 pm
Reply with quote

Would this meet your 'vague' requirement?

IF RJ-EFF-DATE > 99999
MOVE 99999 TO RJ1-EFF-DATE
ELSE
MOVE RJ-EFF-DATE TO RJ1-EFF-DATE
END-IF

If not, what value do you want in the receiving field under those circumstances?

Or, is this a trick question?
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Nov 11, 2010 10:20 pm
Reply with quote

Hello,

Quote:
Here is the requirement.
Sorry, but this is not a requirement. . .

Let us use something liquid rather than 1's and 0's. . . How would the people who defined this "reauirement" suggest the content of a full 7-gallon container be poured into a 3-gallon container and not spill over.

If this is the type of "requirement" that is common, be very careful what is implemented - no matter how much effort is put into it, it will probably not be what "they" want. . .
Back to top
View user's profile Send private message
job1919

New User


Joined: 19 Jul 2010
Posts: 21
Location: Chennai

PostPosted: Fri Nov 12, 2010 9:48 am
Reply with quote

Hi All,

Thanks for the responses.

Actually this date is current date < MMDDYYYY> which is to be reformatted to MMDDYY and later its converted to Julian dates.

So RJ-Eff-Date gets the current system date or a previous date and then I have to trim it to remove 20 in the year and use only 10.

I was wondering what If i can move this RJ-Eff-Date to Var1 (Pic x(8) ) and then redefine it to Month , date , Year and then move .

Please let me know your suggestions.

Thanks
job1919
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 12, 2010 9:54 am
Reply with quote

Hello,

Suggest you practice posting the real requirement rather than something that has nothing (that i can see) with what you actually want. . .

Yes, you can move the mmddccyy date to another field and then use only the mm dd yy parts of this new field to creaye a mmddyy date. From there you can do whatever is needed.

The receiving field when you move the comp-3 field should be zoned decimal not "x(8)".
Back to top
View user's profile Send private message
job1919

New User


Joined: 19 Jul 2010
Posts: 21
Location: Chennai

PostPosted: Fri Nov 12, 2010 2:29 pm
Reply with quote

Dick ,

Thanks very much , It worked .. I moved the Comp3 variable to a variable with X(08) and then redefined to move individually..

Thank you daveporcelan , Robert Sample & Dick once again.

job1919
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Nov 12, 2010 8:25 pm
Reply with quote

Good to hear it is working - thank you for letting us know and posting your solution icon_smile.gif

d
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 How to move the first field of each r... DFSORT/ICETOOL 5
No new posts How to move DB2 Installation HLQ DB2 4
No new posts How to move values from single dimens... COBOL Programming 1
No new posts Reading the CSV data in COBOL and mov... COBOL Programming 4
Search our Forums:

Back to Top