Edit macro FED1040 Edit macro FED1040 Author: David McRitchie formatted on 1995/04/01 06:54 Prepared by David McRitchie of an EXAMPLE of a spreadsheet written in REXX showing calculations Please do not tell me that it is incorrect or not up to date, because it never was designed as a comprehensive tax program. -------------------------------------------------------------------------------- macro NAME. FED1040 users. PDF EDIT users particularly last minute income tax work type. Edit Macro resides in IS03.LIBR.CLIST and IS03.SPF2.MACROS -------------------------------------------------------------------------------- FED1040 Spread Sheet format style in EDIT using REXX -------------------------------------------------------------------------------- related (none) -------------------------------------------------------------------------------- The FED1040 will recalculate lines similar to Spreadsheets on PC's. There are several notable differences between this spread sheet and what you have on a PC. 1. FED1040 will show formulas, description and numeric entires and totals at the same time, without switching between calculated fields and formulas. 2. FED1040 has only one column. 3. You must invoke FED1040 to update your totals. 4. Since you are in edit you may scroll left and right, and exclude lines. Spread sheets may allow to split vertically and or hor- izontally but do not allow several horizontal splits. In order to obtain test data to play with you may copy the test data from is03.libr.clist(FEDT1993). The example should only be taken as an example in preparing a simple spread sheet without a spread sheet package. It is by no means a working tax package, nor are all calcu- lations provided for. The data shown is not confidential it is from some of the examples with your tax forms. -------------------------------------------------------------------------------- ===> FED1040 there are no options on the macro There is no need to save your data until you wish to. The macro will read the lines as they exist in your edit session. Error messages (limited) There is no range or NX options. The entire file will be used. FED1040 will begin recalculations at line 1, and will terminate at any unrecognizable entry. Example using completely incorrect input will result in short and long messages plus the following NOTELINEs. STOPPED -- Calculation at line 1 is not an assignment X=formula STOPPED -- due to errors at line 1 Time of error was 17:57:49 Division by zero is not checked and will result in REXX messages 97 +++ value=1/v 97 +++ interpret calc IRX0042I Error running FED1040, line 97: Arithmetic overflow/underflow *** Usage Column definitions are as follows: 001-001 An asterisk(*) in column indicates a comment. Comments do not en- ter into calculations in any manner. A card that is entirely blank or blank in col 1-59 will also be treated as a comment. A card that is blank in column 1 but has data before column 11 is coded incorrectly, is not currently tested for and you should not enter such coding, though it appears to be ignored in the example. 001-010 Entry values beginning in column 1 are optional. If no value is found in col 1 then there is no value. Values found in column one are assigned a variable name of v. Actually the requirement is that the entry begin in column one, it may continue beyond 10. 011-059 Action statements must be included on non comment cards and may be any of the following: An assignment statement, an IF statement, a NOTEV statement, or a .ZERO statement. May begin and be con- tained anywhere in col 11-59. If there is a value beginning in column one then the action portion may follow the value separated by at least one blank space within col 01-59. 011-059 Assignment statement Assignments should normally be placed beginning in column 11 so that they line up with other assignment statements. If column 1-11 is blank then the assignment statement will be the first word picked up from col 11-59. If column 1-11 is non-blank, there being an entry value, the sec- ond word picked up from col 1-59 will be the assignment state- ment. Assignment statements end with a blank. 011-059 An assignment statement may begin in column 11 (or 11-59). A de- scription may appear after a formula. Formulas do not have spaces when used in FED1040. This is not a REXX requirement it is simply the means by which FED1040 will determine where the end of the formula is. 011-059 IF statement can be used in place of an assignment statement. You may not include a comment on an IF. Columns 60-79 will not be filled in by the program, but for ease of reading you shouldn't use them either. 011-059 NOTEV statement will cause a NOTELINE to be generated for the val- ues shown on the card. 011-059 .ZERO statement may be used to zero out several fields on one card. Simplifies having to generate a lot of single assignment cards. Col 060-079 will be filled in by FED1040 as follows: 060-069 The calculated assignment variable will be printed by FED1040 based on what you assigned in column 11 (or col 11-59) 070-079 The calculated value will be seen right justified on column 79. A simple demo *...5...10...15...20...25...30...35...40...45...50...55...60...65...70...75 ...80 **********=================================================----------====== ==== *---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+ ----8 3 value=v value= 3 a=1/value a= .33333 3333 3 value=v value= 3 a=1/value+140 a= 140.33 3333 a=1/value+140000 a= 140000 .333 a=1/value+3*14000 a= 42000. 3333 3 value=v value= 3 3 value=4 The three is ignored value= 4 3 value=value+v The three is used value= 7 value=4 value= 4 a=1/value+140 a= 14 0.25 a=1/value+140000 a= 14000 0.25 a=1/value+3*14000 a= 4200 0.25 if value > 14 then value = 12 value=value Show value value= 4 notev value a Display values value=4 a=42000.25 Display=DISPLAY values=VALUES .zero display a notev value a Display values value=4 a=0 Display=0 values=VALUES * Some of the following lines are coded incorrectly b=v 14 y=v y= 14 b=v b=v 1 b=v b= 1 2 b=v b= 2 b=v b=v b=v *---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+ ----8 b=v b= b=v 3 b=v b= 3 b=v b= 3 b=v b= 3 *---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+ ----8 * Only ten digits of results will be visible. 1000000000000 c=v c= 000000 0000 c=c/100000 c= 1000 0000 5 c=v c= 5 c=c/100000 c= 0.0 0005 A more complete example The following example can only be seen properly if the following scale is not split and terminates with greater-than (>). xxxxxx 1...5...10...15...20...25...30...35...40...50...55...60...65...70...80...85 ...> EDIT ---- userid.LIBR.cntl(FEDT1993) - 01.01 ---------------------------- C OL xxx xxx COMMAND ===> SCROLL ===> CSR 000001 1993 YEAR=v For YEAR= 1993 000002 *============= use FED1040 macro to update result figures ========== =========== 000003 *============= figures and coding must be changed to match your use =========== 000004 *============= tax table calculation may have to be rearranged depen ding ====== 000005 *============= on whether using Single or Married tables. ========== =========== 000006 * Running times with FEDT1993 data was 000007 * 3.19 seconds TSO, and |Timing begins once macro begins , 000008 * 10.31 seconds OS/2 |so loading macro does not count . 000009 6 xemptions=v Married, exemptions checked off xemptions = 6 000010 * zero out t0,t1,t2,...t100, a0,...,a100,d0,...,d100,temp25 000011 .zero .t .a .d temp25 000012 * show value of selected variables 000013 notev t4 t5 x4 x5 temp25 000014 *NOTE== t4=0 t5=0 x4=X4 x5=X5 temp25=0 000015 *======================= SCHEDULE A -- Itemized Deductions ========= =========== =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+--- -7----+----8 000016 63 a4=v (example) a4= 63 000017 1301 A5=v State and local income (not refunds) A5= 1301 000018 1440 A6=V Real Estate taxes A6= 1440 000019 0 a7=v Other taxes a7= 0 000020 a8=a5+a6+a7 a8= 2741 000021 2910 a12=v (example) a12= 2910 000022 828 a13=v Charitable Contributions a13= 828 000023 a16=a13 a16= 828 000024 3640 a18=v moving expenses a18= 3640 000025 760 a19=v unreimbursed employee expenses a19= 760 000026 0 a20=v investment expense a20= 0 000027 a21=a19+a20 a21= 760 000028 33350 a22=V value of T32, seen later a22= 33350 000029 a23=trunc(a22*.02+.005,2) a23= 667.00 000030 a24=a21-a23 a24= 93.00 000031 if value("a24") < 0 then a24 = 0 000032 a24=a24 a24= 93.00 000033 *------------------------------------------------------------------- -- 000034 * Item 25 -- Other Miscellaneous deductions, List temp25= 0 000035 * Workforce Development Partnership Fund/HCS 000036 * (not actually entered because not sure of entry, 000037 * even if it would be correct, wouldn't make any 000038 * changes to the tax already written and signed.) 000039 *96.60 temp25=temp25+v NJHCS Health Care Subsidy 000040 a25=temp25 a25= 0 000041 a26=A4+A8+a12+a16+a17+a18+a24+a25 a26= 10275.00 000042 t34=a26 Also enter amount one 1040 line t34= 10275.00 000043 *======================= SCHEDULE B -- Interest and Dividend Income =========== 000044 * J. Doaks 000-00-0000 =COLS> ----+----1----+----2----+----3----+----4----+----5----+----6----+--- -7----+----8 000045 430.00 B2=v Interest Income (Attachment A-1) B2= 430.00 000046 750.00 B6=V Dividend Income (Attachment A-1) B6= 750.00 000047 60 b7=v Capital Gain distrib. (A-1) b7= 60 000048 10 b8=v Nontaxable Distributions b8= 10 000049 b9=b7+b8 b9= 70 000050 b10=b6-b9 b10= 680.00 000051 *======================= FEDERAL 1040 -- Income Tax ================ =========== 000052 20940 T7=v Wages (W-2) T7= 20940 000053 t8a=b2 t8a= 430.00 000054 t9=b10 t9= 680.00 000055 110 t10=v Previous year State Tax refund t10= 110 000056 1900 t13=v Capital Gain(Loss) from D18 t13= 1900 000057 2100 t17b=v t17b= 2100 000058 10500 t18=v From Sched E (if attached) t18= 10500 000059 50.00 t22=v Other income -- Contest prize t22= 50.00 000060 t23=t7+t8a+t9+t10+t13+t17b+t18+t22 t23= 36710.00 000061 3360 t30=v t30= 3360 000062 t31=t23-t30 t31= 33350.00 000063 t32=t31 t32= 33350.00 000064 t34=t34 from Schedule A (6144.40) t34= 10275.00 000065 t35=t32-t34 t35= 23075.00 000066 t36=2350*xemptions t36= 14100 000067 t37=t35-t36 Look Up this line in tax Table> t37= 8975.00 000068 * Tax Tables use $50 increments, based on mid-point 000069 mid=trunc((t37-t37//50+25),2) mid= 8975.00 000070 * *** *** 000071 * Calculation for the 15% bracket is approx=... *** *** 000072 if value("t37")<22100 then approx=trunc(.15*(mid),2) 000073 * Calculation for the 28% bracket is approx=... *** *** 000074 if value("t37") > 22100 then approx=3315+.28*(mid-22100) 000075 * Calculation for the 31% bracket is approx=... *** *** 000076 if value("t37") > 53500 then approx=12107+.31*(t37-53500) 000077 * for taxable income line 37, expect the tax 000078 * table to show the following amount 000079 approx=trunc(approx+.005,2) approx= 1346.25 000080 * Now look it up and enter below. 000081 * Now look it up in table and enter real tax amount below 000082 * For this example T38 will be filled in for you. 000083 t38=approx-approx//1 t38= 1346.00 000084 0 t39=v Additional Taxes t39= 0 000085 t40=t38+t39 t40= 1346.00 000086 0 t43=v Foreign Tax credit form 1116 t43= 0 000087 1200 t44=v Form 8834 attached for credits t44= 1200 000088 t45=t43+t44 t45= 1200 000089 t46=t40-t45 t46= 146.00 000090 919 t47=v (example, self-employment tax) t47= 919 000091 t53=t46+t47+t48+t49+t50+t51+t52 t53= 1065.00 000092 2287.78 t54=v Amount WITHHELD t54= 2287.78 000093 t60=t54 t60= 2287.78 000094 t62=t60-t53 REFUND if greater than ZERO t62= 1222.78 000095 * 000096 * 000097 * ==================== New Jersey 1040 ============================= ======= 000098 * ==================== New Jersey 1040 ============================= ======= 000099 YEAR=YEAR For YEAR= 1993 000100 * set Konstants 000101 xemptions=xemptions Married plus four deduct. xemptions = 6 000102 .zero NJ17 nj18 nu19c nj20 000103 .zero NJ14 NJ15a NJ16 NJ17 NJ18 NJ19c NJ20 NJ25 000104 * end of Konstants and initialization 000105 * NJ Schedule B ==================================================== 000106 >>> NJB1=(-900)+2800 NJB1= 1900 000107 * comprised of Short term capital gains 000108 * and long term capital gains, 000109 60 NJB2=v Capital Gains Distributions NJB2= 60 000110 njb4=NJB1+njb2 njb4= 1960 000111 * NJ Schedule 1040 main sheet(s) =================================== 000112 5 NJ15b=v Tax exempt interest income NJ15b= 5 000113 * from K-1, do not include on NJ15a 000114 * 000115 NJ6=xemptions NJ6= 6 000116 NJ12a=xemptions NJ12a= 6 000117 22940.00 NJ14=v Taxable NJ income (W-2) NJ14= 22940.00 000118 NJ15a=b2-NJ15b taxable interest income NJ15a= 425.00 000119 NJ15b=NJ15b tax exempt interest NJ15b= 5 000120 NJ16=T9 Ordinary dividend income NJ16= 680.00 000121 nj18=njb4 NJ SCHEDULE B line 4 nj18= 1960 000122 0 NJ20=v Distributive share of 1065 NJ20= 0 000123 * (do not enter passive income on line 20) 000124 NJ24=20.80 Other income (jury duty) NJ24= 20.80 000125 NJ25=0+NJ24 NJ25= 20.80 000126 NJ26a=NJ14+NJ15a+NJ16+NJ17+NJ18+NJ19c+NJ20+NJ25 NJ26a= 26025.80 000127 NJ26c=NJ26a NJ26c= 26025.80 000128 NJ27a=xemptions*1000.00 01 x $1000. NJ27a= 6000.00 000129 NJ27b=0 no xemptions on 12b NJ27b= 0 000130 NJ27c=NJ27a+NJ27b NJ27c= 6000.00 000131 NJ30=NJ27c NJ30= 6000.00 000132 NJ31=NJ26c-NJ30 NJ31= 20025.80 000133 if nj31>0 then NJ32=trunc((.020*NJ31-0000)+.005,2) 000134 if nj31>0 then rate=.020 000135 * Get tax from Rate Schedule (Single) 000136 if NJ31>20000 then NJ32=trunc((.025*NJ31-100)+.005,2) 000137 if NJ31>20000 then rate=.25 000138 if NJ31>35000 then NJ32=trunc((.050*NJ31-975)+.005,2) 000139 if NJ31>35000 then rate=.05 000140 if NJ31>40000 then NJ32=trunc((.065*NJ31-1575)+.005,2) 000141 if NJ31>40000 then rate=.065 000142 if NJ31>75000 then NJ32=trunc((.070*NJ31-1950)+.005,2) 000143 if NJ31>75000 then NJ32=.070 000144 single=nj32 single= 400.65 000145 rate=rate rate= .25 000146 * Get tax from Rate Schedule (Married) 000147 if NJ31>20000 then NJ32=trunc((.025*NJ31-100)+.005,2) 000148 if NJ31>20000 then rate=.025 000149 if NJ31>50000 then NJ32=trunc((.035*NJ31-600)+.005,2) 000150 if NJ31>50000 then rate=.035 000151 if NJ31>70000 then NJ32=trunc((.050*NJ31-1650)+.005,2) 000152 if NJ31>70000 then rate=.050 000153 if NJ31>80000 then NJ32=trunc((.065*NJ31-2850)+.005,2) 000154 if NJ31>80000 then rate=.065 000155 if NJ31>150000 then NJ32=trunc((.070*NJ31-3600)+.005,2) 000156 if NJ31>150000 then rate=.07 000157 married=nj32 married= 400.65 000158 rate=rate rate= .025 000159 if xemptions = 1 then nj32=single 000160 if xemptions > 1 then nj32=married 000161 * nj32=trunc(nj32,0) example used whole dollars 000162 * Using tax calculated for line NJ32 000163 NJ32=NJ32 NJ32= 400.65 000164 NJ34=NJ32 NJ34= 400.65 000165 NJ36=NJ34 NJ36= 400.65 000166 NJ37=NJ36 NJ37= 400.65 000167 437.77 NJ38=v INCOME TAX WITHHELD NJ38= 437.77 000168 NJ42=NJ38+0 NJ42= 437.77 000169 *** If amount is owed payable to New Jersey TGI 000170 NJ43=NJ37-NJ42 AMOUNT OWED TO NJ, IF > ZERO NJ43= -37.12 000171 NJ44=NJ42-NJ37 Amount OVERPAID, IF > ZERO NJ44= 37.12 000172 NJ47=NJ44 REFUND if > ZERO NJ47= 37.12 000173 *** 000174 *** NJ -- Homestead Property Tax Rebate application 000175 *** Line 5 -- Homeowner 000176 *** Line 6 -- Block xx, Lot xxx 000177 ho1=NJ26c ho1= 26025.80 000178 ho3=ho1 ho3= 26025.80 000179 2784.15 HO8=v HO8= 2784.15 000180 * 000181 *===================================================== 000182 CLGains=-9313.88+17233.89 CLGains= 7920.01 000183 CSGains=-4546+385 CSGains= -4161 000184 TotCGains=CLGains+CSGains TotCGains = 3759.01 000185 *===================================================== 000186 * The following should MATCH each other... 000187 * New Jersey will not Match in this Example because 000188 * there is no New Jersey example to match Fed 1040 example 000189 notev t13 d18 000190 *t13=1900 d18=0 000191 * diff=t13-d18 000192 notev b7 njb2 000193 *NOTE== *b7=60 njb2=60 000194 diff=b7-njb2 diff= 0 000195 notev nj16 t9 000196 *NOTE== *nj16=680.00 t9=680.00 000197 diff=nj16-t9 diff= 0 Internal Aspects How does it work. Well REXX is an interpretive language and the formulas that you see are actually used in the macro by using interpret statements. All fields must have been initialized before use. And of course don't di- vide by zero.