View previous topic :: View next topic
|
Author |
Message |
job1919
New User
Joined: 19 Jul 2010 Posts: 21 Location: Chennai
|
|
|
|
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 |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
job1919
New User
Joined: 19 Jul 2010 Posts: 21 Location: Chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
job1919
New User
Joined: 19 Jul 2010 Posts: 21 Location: Chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Good to hear it is working - thank you for letting us know and posting your solution
d |
|
Back to top |
|
|
|