Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

from 201 to 2001 2

Status
Not open for further replies.

claudeb

Programmer
Nov 23, 2000
140
CA
Hi everybody,
Instead of 201, I need to put the full year 2001 in W-CURRENT-YYYY

01 WGLOB-PROCESS-DATE PIC X(07).

01 W-CURRENT-DATE PIC 9(8).
01 W-CURRENT-DATE-R REDEFINES
W-CURRENT-DATE.
05 W-CURRENT-YYYY PIC 9999.
05 W-CURRENT-MM PIC 99.
05 W-CURRENT-DD PIC 99.

WGLOB-PROCESS-DATE= 2010920. This is the main field.
I declared a new variable W- WGLOB-PROCESS-DATE

01 W-WGLOB-PROCESS-DATE PIC X(7).
01 W-WGLOB-PROCESS-DATE-R REDEFINES
W-WGLOB-PROCESS-DATE.
05 W-WGLOB-PROCESS-DATE-YYYY PIC 9(3).
05 W-WGLOB-PROCESS-DATE-MM PIC 9(2).
05 W-WGLOB-PROCESS-DATE-DD PIC 9(2).
Move WGLOB-PROCESS-DATE to W-WGLOB-PROCESS-DATE.
Add 1800 to W-WGLOB-PROCESS-DATE-YYYY giving W-CURRENT-YYYY.
I get an abend ! ! Interupt code 07 .Could you , please, tell me why
Thanks
 
try making the field you are adding to a numeric one, and see if that does the trick.
 
hi pipk,
it is numeric.
W-WGLOB-PROCESS-DATE-YYYY PIC 9(3).
are you refering to something else ?
thanks
 
may be its an overflow.

it is a long time since i wrote any cobol (4 years to be precise) an so i am a bit foggy on what the length of a field actually specifies - but if your field only has room for 3 digits, won't adding a four digit number to it mess it up.

by the way, thanks for the star, its not often you get a vote for being wrong but hey there you go.

 
now you deserve 2 stars, because it worked. i would have never thought of that.
thanks again.
 
hooray, you see, there's life in the old dog yet....
 
well, it didn't work ! i am not taking back the star.
there must be some thing i don't know or understand.
thanks anyway.
 
Are you moving the month and day to your target fields in W-CURRENT-DATE? Your problem could be with that part of the field, not the year part.

Stephen J Spiro
Member, J4 COBOL Standards Committee
check it out at

stephenjspiro@mail.com
 
you are right W-WGLOB-PROCESS-DATE-MM and W-WGLOB-PROCESS-DATE-DD were empty.
Thanks a lot.
 
I think it is time for me to retire from this forum and stick to the more recent stuff I have been doing. adios amigos - happy coding.
 
Hi Claude,

You can try this:

Define your I/P date as pic 9s, then:

COMPUTE W-CURRENT-DATE = WGLOB-PROCESS-DATE
+ 180000000
 
pipk, don't quit. i don't know more than you do.
Slade, i think that your solution is much better than mine.
Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top