// // time: Wed Apr 24 07:53:02 1996 // // version: 3.0.0 (format), 3.1.0 (DX) // // // Begin MDF // MODULE JulianDayToMonthDay // CATEGORY Calendar // DESCRIPTION Converts a numeric Julian day and year to a DD-MMM-YYYY string // INPUT year; value list or field; (none); Year // INPUT JD; value list or field; 1; Julian Day // OUTPUT jd_string; string; dd-mmm-yyyy format // OUTPUT date_string; string; yyyymmdd format // End MDF // // comment: Given a year and Julian day for that year, a year, month and day of month string is created in two formats: dd-mmm-yyy and yyyymmdd, where mmm is a string month (i.e., Jan, Feb, etc.) and mm is the month number. // comment: // comment: (C) COPYRIGHT International Business Machines Corp. 1996. // comment: All Rights Reserved. // comment: Licensed Materials - Property of IBM // comment: // comment: Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation, and that the name of IBM not be used in advertising or publicity pertaining to distribution of the software without specific prior written permission. // comment: // comment: INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THE SOFTWARE, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS, "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IBM DOES NOT WARRANT AGAINST THE INFRINGMENT OF PATENTS, COPYRIGHT OR ANY OTHER INTELLECTUAL PROPERTY RIGHTS OF OTHERS. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE, BOTH INDIVIDUALLY AND AS ONE OR MORE GROUPS, IS WITH YOU. // workspace: width = 1181, height = 661 // layout: snap = 0, width = 50, height = 50, align = UL // macro JulianDayToMonthDay( year ,JD = 1 ) -> ( jd_string ,date_string ) { // // node Input[1]: x = 8, y = 0, inputs = 0, label = Input // parameter: position = 1, name = 'year', value = ' ', descriptive = 0, description = 'Year', required = 1, visible = 1 // JulianDayToMonthDay_Input_1_out_1 = year; // // node Transmitter[4]: x = 97, y = 63, inputs = 1, label = year // year = JulianDayToMonthDay_Input_1_out_1; // // node Receiver[4]: x = 900, y = 434, inputs = 1, label = year // JulianDayToMonthDay_Receiver_4_out_1 = year; // // node Compute[1]: x = 9, y = 104, inputs = 2, label = Compute // input[1]: defaulting = 0, visible = 0, type = 32, value = "(mod($0,4) == 0 && mod($0,100) != 0) + 1" // expression: value = (mod(year,4) == 0 && mod(year,100) != 0) + 1 // name[2]: value = year // JulianDayToMonthDay_Compute_1_out_1 = Compute( "(mod($0,4) == 0 && mod($0,100) != 0) + 1", JulianDayToMonthDay_Input_1_out_1 ) [instance: 1, cache: 1]; // // node Transmitter[2]: x = 0, y = 256, inputs = 1, label = leap_year // leap_year = JulianDayToMonthDay_Compute_1_out_1; // // node Receiver[6]: x = 366, y = 192, inputs = 1, label = leap_year // JulianDayToMonthDay_Receiver_6_out_1 = leap_year; // // node Input[2]: x = 484, y = 0, inputs = 0, label = Input // parameter: position = 2, name = 'JD', value = '1', descriptive = 0, description = 'Julian Day', required = 0, visible = 1 // JulianDayToMonthDay_Input_2_out_1 = JD; // // node Compute[5]: x = 437, y = 111, inputs = 2, label = Compute // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 > 365 ? 365 : $0 < 1 ? 1 : $0" // expression: value = day > 365 ? 365 : day < 1 ? 1 : day // name[2]: value = day // JulianDayToMonthDay_Compute_5_out_1 = Compute( "$0 > 365 ? 365 : $0 < 1 ? 1 : $0", JulianDayToMonthDay_Input_2_out_1 ) [instance: 5, cache: 1]; // // node Compute[6]: x = 521, y = 150, inputs = 2, label = Compute // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 > 366 ? 366 : $0 < 1 ? 1 : $0" // expression: value = day > 366 ? 366 : day < 1 ? 1 : day // name[2]: value = day // JulianDayToMonthDay_Compute_6_out_1 = Compute( "$0 > 366 ? 366 : $0 < 1 ? 1 : $0", JulianDayToMonthDay_Input_2_out_1 ) [instance: 6, cache: 1]; // // node Switch[3]: x = 463, y = 257, inputs = 3, label = Switch // JulianDayToMonthDay_Switch_3_out_1 = Switch( JulianDayToMonthDay_Receiver_6_out_1, JulianDayToMonthDay_Compute_5_out_1, JulianDayToMonthDay_Compute_6_out_1 ) [instance: 3, cache: 1]; // // node Transmitter[1]: x = 458, y = 362, inputs = 1, label = julian_day // julian_day = JulianDayToMonthDay_Switch_3_out_1; // // node Receiver[7]: x = 198, y = 74, inputs = 1, label = julian_day // JulianDayToMonthDay_Receiver_7_out_1 = julian_day; // // node Compute[2]: x = 133, y = 186, inputs = 2, label = Compute // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0>0&&$0<32?0 : $0>31&&$0<60?1 : $0>59&&$0<91?2 : $0>90&&$0<121?3 : $0>120&&$0<152?4 : $0>151&&$0<182?5 : $0>181&&$0<213?6 : $0>212&&$0<244?7 : $0>243&&$0<274?8 : $0>273&&$0<305?9 : $0>304&&$0<335?10 : $0>334?11 : 0" // expression: value = d>0&&d<32?0 : d>31&&d<60?1 : d>59&&d<91?2 : d>90&&d<121?3 : d>120&&d<152?4 : d>151&&d<182?5 : d>181&&d<213?6 : d>212&&d<244?7 : d>243&&d<274?8 : d>273&&d<305?9 : d>304&&d<335?10 : d>334?11 : 0 // name[2]: value = d // JulianDayToMonthDay_Compute_2_out_1 = Compute( "$0>0&&$0<32?0 : $0>31&&$0<60?1 : $0>59&&$0<91?2 : $0>90&&$0<121?3 : $0>120&&$0<152?4 : $0>151&&$0<182?5 : $0>181&&$0<213?6 : $0>212&&$0<244?7 : $0>243&&$0<274?8 : $0>273&&$0<305?9 : $0>304&&$0<335?10 : $0>334?11 : 0", JulianDayToMonthDay_Receiver_7_out_1 ) [instance: 2, cache: 1]; // // node Compute[3]: x = 233, y = 188, inputs = 2, label = Compute // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0>0&&$0<32?0 : $0>31&&$0<61?1 : $0>60&&$0<92?2 : $0>91&&$0<122?3 : $0>121&&$0<153?4 : $0>152&&$0<183?5 : $0>182&&$0<214?6 : $0>214&&$0<245?7 : $0>244&&$0<275?8 : $0>274&&$0<306?9 : $0>305&&$0<336?10 : $0>335?11 : 0" // expression: value = d>0&&d<32?0 : d>31&&d<61?1 : d>60&&d<92?2 : d>91&&d<122?3 : d>121&&d<153?4 : d>152&&d<183?5 : d>182&&d<214?6 : d>214&&d<245?7 : d>244&&d<275?8 : d>274&&d<306?9 : d>305&&d<336?10 : d>335?11 : 0 // name[2]: value = d // JulianDayToMonthDay_Compute_3_out_1 = Compute( "$0>0&&$0<32?0 : $0>31&&$0<61?1 : $0>60&&$0<92?2 : $0>91&&$0<122?3 : $0>121&&$0<153?4 : $0>152&&$0<183?5 : $0>182&&$0<214?6 : $0>214&&$0<245?7 : $0>244&&$0<275?8 : $0>274&&$0<306?9 : $0>305&&$0<336?10 : $0>335?11 : 0", JulianDayToMonthDay_Receiver_7_out_1 ) [instance: 3, cache: 1]; // // node Switch[1]: x = 136, y = 290, inputs = 3, label = Switch // JulianDayToMonthDay_Switch_1_out_1 = Switch( JulianDayToMonthDay_Compute_1_out_1, JulianDayToMonthDay_Compute_2_out_1, JulianDayToMonthDay_Compute_3_out_1 ) [instance: 1, cache: 1]; // // node Transmitter[3]: x = 125, y = 400, inputs = 1, label = month // month = JulianDayToMonthDay_Switch_1_out_1; // // node Receiver[3]: x = 942, y = 277, inputs = 1, label = month // JulianDayToMonthDay_Receiver_3_out_1 = month; // // node Compute[67]: x = 973, y = 393, inputs = 2, label = Compute // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0+1" // expression: value = a+1 // name[2]: value = a // JulianDayToMonthDay_Compute_67_out_1 = Compute( "$0+1", JulianDayToMonthDay_Receiver_3_out_1 ) [instance: 67, cache: 1]; // // node Receiver[1]: x = 643, y = 280, inputs = 1, label = julian_day // JulianDayToMonthDay_Receiver_1_out_1 = julian_day; // // node Receiver[2]: x = 677, y = 103, inputs = 1, label = leap_year // JulianDayToMonthDay_Receiver_2_out_1 = leap_year; // // node Import[2]: x = 727, y = 19, inputs = 6, label = Import // input[1]: defaulting = 0, visible = 1, type = 32, value = "months_day" // input[2]: visible = 0 // input[3]: visible = 0 // JulianDayToMonthDay_Import_2_out_1 = Import( "months_day", NULL, NULL, NULL, NULL, NULL ) [instance: 2, cache: 1]; // // node Import[3]: x = 904, y = 0, inputs = 6, label = Import // input[1]: defaulting = 0, visible = 1, type = 32, value = "months_day_leap" // input[2]: visible = 0 // input[3]: visible = 0 // JulianDayToMonthDay_Import_3_out_1 = Import( "months_day_leap", NULL, NULL, NULL, NULL, NULL ) [instance: 3, cache: 1]; // // node Switch[2]: x = 790, y = 121, inputs = 3, label = Switch // JulianDayToMonthDay_Switch_2_out_1 = Switch( JulianDayToMonthDay_Receiver_2_out_1, JulianDayToMonthDay_Import_2_out_1, JulianDayToMonthDay_Import_3_out_1 ) [instance: 2, cache: 1]; // // node Receiver[5]: x = 882, y = 170, inputs = 1, label = month // JulianDayToMonthDay_Receiver_5_out_1 = month; // // node Select[2]: x = 792, y = 247, inputs = 3, label = Select // JulianDayToMonthDay_Select_2_out_1 = Select( JulianDayToMonthDay_Switch_2_out_1, JulianDayToMonthDay_Receiver_5_out_1, NULL ) [instance: 2, cache: 1]; // // node Compute[4]: x = 727, y = 359, inputs = 3, label = Compute // input[1]: defaulting = 0, visible = 0, type = 32, value = "$0 - $1 + 1" // expression: value = jd - month_beg + 1 // name[2]: value = jd // name[3]: value = month_beg // JulianDayToMonthDay_Compute_4_out_1 = Compute( "$0 - $1 + 1", JulianDayToMonthDay_Receiver_1_out_1, JulianDayToMonthDay_Select_2_out_1 ) [instance: 4, cache: 1]; // // node Transmitter[5]: x = 629, y = 463, inputs = 1, label = day_of_month // day_of_month = JulianDayToMonthDay_Compute_4_out_1; // // node Receiver[8]: x = 1084, y = 418, inputs = 1, label = day_of_month // JulianDayToMonthDay_Receiver_8_out_1 = day_of_month; // // node Format[2]: x = 970, y = 494, inputs = 4, label = Format // input[1]: defaulting = 0, visible = 0, type = 32, value = "%04d%02d%02d" // JulianDayToMonthDay_Format_2_out_1 = Format( "%04d%02d%02d", JulianDayToMonthDay_Receiver_4_out_1, JulianDayToMonthDay_Compute_67_out_1, JulianDayToMonthDay_Receiver_8_out_1 ) [instance: 2, cache: 1]; // // node Output[7]: x = 976, y = 598, inputs = 1, label = Output // parameter: position = 2, name = 'date_string', value = ' ', descriptive = 0, description = 'yyyymmdd format', required = 0, visible = 1 // date_string = JulianDayToMonthDay_Format_2_out_1; // // node Import[1]: x = 871, y = 254, inputs = 6, label = Import // input[1]: defaulting = 0, visible = 1, type = 32, value = "months_short" // input[2]: visible = 0 // input[3]: visible = 0 // JulianDayToMonthDay_Import_1_out_1 = Import( "months_short", NULL, NULL, NULL, NULL, NULL ) [instance: 1, cache: 1]; // // node Select[1]: x = 904, y = 346, inputs = 3, label = Select // JulianDayToMonthDay_Select_1_out_1 = Select( JulianDayToMonthDay_Import_1_out_1, JulianDayToMonthDay_Receiver_3_out_1, NULL ) [instance: 1, cache: 1]; // // node Format[1]: x = 773, y = 468, inputs = 4, label = Format // input[1]: defaulting = 0, visible = 0, type = 32, value = "%02d-%s-%04d" // JulianDayToMonthDay_Format_1_out_1 = Format( "%02d-%s-%04d", JulianDayToMonthDay_Compute_4_out_1, JulianDayToMonthDay_Select_1_out_1, JulianDayToMonthDay_Receiver_4_out_1 ) [instance: 1, cache: 1]; // // node Output[1]: x = 810, y = 573, inputs = 1, label = Output // parameter: position = 1, name = 'jd_string', value = ' ', descriptive = 0, description = 'dd-mmm-yyyy format', required = 0, visible = 1 // jd_string = JulianDayToMonthDay_Format_1_out_1; // network: end of macro body } JulianDayToMonthDay_Input_1_out_1 = NULL; JulianDayToMonthDay_Transmitter_4_out_1 = NULL; JulianDayToMonthDay_Receiver_4_out_1 = NULL; JulianDayToMonthDay_Compute_1_out_1 = NULL; JulianDayToMonthDay_Transmitter_2_out_1 = NULL; JulianDayToMonthDay_Receiver_6_out_1 = NULL; JulianDayToMonthDay_Input_2_out_1 = NULL; JulianDayToMonthDay_Compute_5_out_1 = NULL; JulianDayToMonthDay_Compute_6_out_1 = NULL; JulianDayToMonthDay_Switch_3_out_1 = NULL; JulianDayToMonthDay_Transmitter_1_out_1 = NULL; JulianDayToMonthDay_Receiver_7_out_1 = NULL; JulianDayToMonthDay_Compute_2_out_1 = NULL; JulianDayToMonthDay_Compute_3_out_1 = NULL; JulianDayToMonthDay_Switch_1_out_1 = NULL; JulianDayToMonthDay_Transmitter_3_out_1 = NULL; JulianDayToMonthDay_Receiver_3_out_1 = NULL; JulianDayToMonthDay_Compute_67_out_1 = NULL; JulianDayToMonthDay_Receiver_1_out_1 = NULL; JulianDayToMonthDay_Receiver_2_out_1 = NULL; JulianDayToMonthDay_Import_2_out_1 = NULL; JulianDayToMonthDay_Import_3_out_1 = NULL; JulianDayToMonthDay_Switch_2_out_1 = NULL; JulianDayToMonthDay_Receiver_5_out_1 = NULL; JulianDayToMonthDay_Select_2_out_1 = NULL; JulianDayToMonthDay_Compute_4_out_1 = NULL; JulianDayToMonthDay_Transmitter_5_out_1 = NULL; JulianDayToMonthDay_Receiver_8_out_1 = NULL; JulianDayToMonthDay_Format_2_out_1 = NULL; JulianDayToMonthDay_Import_1_out_1 = NULL; JulianDayToMonthDay_Select_1_out_1 = NULL; JulianDayToMonthDay_Format_1_out_1 = NULL;