Focal Point
Create a file with current and previous year values.

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/3611018331

November 09, 2004, 07:49 PM
webfocuspgm
Create a file with current and previous year values.
I interested in ideas for the best way to create a file that would contain current year, and then calculate using current year - 1, current year - 2 and current year - 3. This file would then be used in other programs.

Does anyone currently have a date routine that does this function ... ? or anyone like to share their ideas ...?

I have some ideas but they seem 'clunky'... I'd like to hear what other ideas are out there.
November 09, 2004, 08:30 PM
TexasStingray
you might try using dialog manager; looping and -write to create a simple file.
November 09, 2004, 08:37 PM
susannah
seems to me that years are the simplest 'date-ish' things and that you don't actually need a date format to decrement them, just handle them as integer and decrement.
2004
2004-1
2004-2
etc.
you may not need to use date formats at all.
If you're in dm, then
-SET &THISYEAR = EDIT(&YYMD,'9999');
-SET &LASTYEAR = &THISYEAR - 1 ;
November 10, 2004, 02:56 PM
webfocuspgm
I like the dialogue manager idea, much better than mine.... Here is what I have BUT.....

The file contains this......
200420032002200120001999

What I really need is .....
2004
2003
2002
2001
2000
1999

I don't know how to control the DM and the -WRITE commands to create this... I really thought multiple -WRITE commands would do this. I've tried using the APPEND command but that gave me an error.



-TOP
FILEDEF YEARHOLD02 DISK D:\ibi-dev\ibi\apps_srv\baseapp\yearhold02.ftm (RECFM F LRECL 4)
-RUN
-SET &THISYEAR = EDIT(&YYMD,'9999');
-SET &YEARIS = &THISYEAR ;
-WRITE YEARHOLD02 NOCLOSE &YEARIS
-RUN
-SET &YEARIS = &THISYEAR - 1 ;
-WRITE YEARHOLD02 NOCLOSE &YEARIS
-RUN
-SET &YEARIS = &THISYEAR - 2 ;
-WRITE YEARHOLD02 NOCLOSE &YEARIS
-RUN
-SET &YEARIS = &THISYEAR - 3 ;
-WRITE YEARHOLD02 NOCLOSE &YEARIS
-RUN
-SET &YEARIS = &THISYEAR - 4 ;
-WRITE YEARHOLD02 NOCLOSE &YEARIS
-RUN
-SET &YEARIS = &THISYEAR - 5 ;
-WRITE YEARHOLD02 NOCLOSE &YEARIS
-CLOSE
-RUN

This message has been edited. Last edited by: <Mabel>,
November 10, 2004, 08:00 PM
susannah
how about this:
FILEDEF INPUT DISK whereever
FILEDEF OUTPUT DISK whevever
-RUN
-READ INPUT NOCLOSE &YR1.A4 &Y42.A4 &YR3.A4 &YR4.A4 ..etc
-WRITE OUTFILE NOCLOSE &YR1
-WRITE OUTFILE NOCLOSE &YR2
-WRITE OUTFILE NOCLOSE &YR3
November 12, 2004, 01:03 PM
webfocuspgm
susannah,
Yes.... taking that I got it to work.

OK now the problem is I can't get it to populate my drop-down correctly. I want 2004 to be first but 1999 shows up first and there are no controls inside Resource Layout to control the sort order.

Just when I thought I got it to work... thanks for all the input.