Build Month Array

jpachut

New Member
HELP!!!
I am trying to build a month date array with the following code...

/********************************************************************/
/* Find Month and build Month Date Array */
/********************************************************************/
/* assign var[1] to beginning of month from start date */
assign ws-week-date [1] = date(month(in_start_date), 1, year(in_start_date))

do sub1 = 2 to 12:
sub2 = sub1 - 1.
if month(ws-week-date [1])+sub2 > 12 then
ws-week-date [sub1] = date(month(ws-week-date [1])+sub2-12, 1, year(ws-week-date [sub2])+1).
else
ws-week-date [sub1] = date(month(ws-week-date [1])+sub2, 1, year(ws-week-date [sub2])).
end.

However I am getting this compile error...
[FONT=r_ansi]Colon followed by white space terminates a statement. (199)

I am currently using version 9.1c on Progress
Can anyone help me with this code, I can't figure out why its not working...


[/FONT]
 
Re: Build Month Array ????

That seems a strange approach. Why didn't you just string a var with a csv eg, initial 'Jan,Feb,Mar...' then substring as
 

jpachut

New Member
:) Thanks Stef

I am almost throught this array now the compiler does not like

[FONT=r_symbol][/FONT][FONT=r_ansi]** Unable to understand after -- "sub1] = date". (247) [/FONT][FONT=r_symbol]
[/FONT][FONT=r_ansi]** Could not understand line 91. (198) [/FONT][FONT=r_symbol]
[/FONT][FONT=r_ansi]
[/FONT][FONT=r_ansi]ws-month-date [sub1] = date(month(ws-month-date [1]) + sub2, 1,

I really really appreciate your help and quick responses...

Jeanne :blush:
[/FONT]
 

jpachut

New Member
Re: Build Month Array ????

That seems a strange approach. Why didn't you just string a var with a csv eg, initial 'Jan,Feb,Mar...' then substring as


The code has already been written previously to build by week, so they
just want to change it to build by month

Our material control manager wants to see how to schedule our production by work center for the month by build hours ...

Here is the week array that works
[FONT=r_ansi]if month(in_start_date) = 1 then[/FONT]
[FONT=r_ansi]assign ws-month-date [1] = in_start_date + 1.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]if month(in_start_date) = 2 then[/FONT]
[FONT=r_ansi]assign ws-month-date [1] = in_start_date.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]if month(in_start_date) = 3 then[/FONT]
[FONT=r_ansi]assign ws-month-date [1] = in_start_date - 1.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]if month(in_start_date) = 4 then[/FONT]
[FONT=r_ansi]assign ws-month-date [1] = in_start_date - 2.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]if month(in_start_date) = 5 then[/FONT]
[FONT=r_ansi]assign ws-month-date [1] = in_start_date - 3.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]if month(in_start_date) = 6 then[/FONT]
[FONT=r_ansi]assign ws-month-date [1] = in_start_date - 4.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]assign ws-month-date [1] = in_start_date - 5.[/FONT]
[FONT=r_ansi]do sub1 = 2 to 12:[/FONT]
[FONT=r_ansi]sub2 = sub1 - 1.[/FONT]
[FONT=r_ansi]ws-month-date [sub1] = ws-month-date [sub2] + 7.[/FONT]
[FONT=r_ansi]end.[/FONT]
 

jpachut

New Member
Re: Build Month Array ????

Sorry wrong Week array build Code...


The code has already been written previously to build by week, so they
just want to change it to build by month

Our material control manager wants to see how to schedule our production by work center for the month by build hours ...

Here is the week array that works
[FONT=r_ansi][FONT=r_ansi]if weekday(in_start_date) = 1 then[/FONT]
[FONT=r_ansi] assign ws-week-date [1] = in_start_date + 1.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]if weekday(in_start_date) = 2 then[/FONT]
[FONT=r_ansi] assign ws-week-date [1] = in_start_date.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]if weekday(in_start_date) = 3 then[/FONT]
[FONT=r_ansi] assign ws-week-date [1] = in_start_date - 1.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]if weekday(in_start_date) = 4 then[/FONT]
[FONT=r_ansi] assign ws-week-date [1] = in_start_date - 2.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]if weekday(in_start_date) = 5 then[/FONT]
[FONT=r_ansi] assign ws-week-date [1] = in_start_date - 3.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi]if weekday(in_start_date) = 6 then[/FONT]
[FONT=r_ansi] assign ws-week-date [1] = in_start_date - 4.[/FONT]
[FONT=r_ansi]else[/FONT]
[FONT=r_ansi] assign ws-week-date [1] = in_start_date - 5.[/FONT]
[FONT=r_ansi] [/FONT]
[FONT=r_ansi]do sub1 = 2 to 17:[/FONT]
[FONT=r_ansi] sub2 = sub1 - 1.[/FONT]
[FONT=r_ansi] ws-week-date [sub1] = ws-week-date [sub2] + 7.[/FONT]
[FONT=r_ansi]end.[/FONT]
[/FONT]
 
Top