--- title: "SUM routine" type: "article" slug: "sum-routine" url: "http://localhost/article/sum-routine/" markdown_url: "http://localhost/article/sum-routine.md" published_at: "2023-04-04T00:01:33+00:00" modified_at: "2026-06-21T23:26:09+00:00" featured_image: url: "http://localhost/wp-content/uploads/2022/04/20230809-041332.jpg" excerpt: "I needed a different type of routine for number crunching instead of the TALLY routine. Basically, I needed an entire line to be treated as one value instead of half and half, and 1 needed some of the answer printed out if necessary. The following is the result. I call it the SUM routine and…" category: - name: "Extensions" slug: "extensions" taxonomy: "category" url: "http://localhost/category/periodicals/extensions/" post_tag: - name: "Full Text" slug: "fulltext" taxonomy: "post_tag" url: "http://localhost/tag/fulltext/" - name: "Pro/File 2068" slug: "pro-file-2068" taxonomy: "post_tag" url: "http://localhost/tag/pro-file-2068/" - name: "TS 2068" slug: "ts2068" taxonomy: "post_tag" url: "http://localhost/tag/ts2068/" - name: "Type-in program" slug: "type-in-program" taxonomy: "post_tag" url: "http://localhost/tag/type-in-program/" model: - name: "Timex/Sinclair 2068" slug: "ts-2068" taxonomy: "model" url: "http://localhost/model/ts-2068/" indiv: - name: "Robert Fischer" slug: "robert-fischer" taxonomy: "indiv" url: "http://localhost/indiv/robert-fischer/" publication_r: id: 39138 title: "Extensions" type: "periodical" url: "http://localhost/periodical/extensions/" authors: "Robert Fischer" authors_r: - name: "Robert Fischer" slug: "robert-fischer" taxonomy: "indiv" url: "http://localhost/indiv/robert-fischer/" issue: "3" issues_articles: - id: 49309 title: "Extensions issue 3" type: "issue" url: "http://localhost/issue/extensions-3/" pages: "2" product_reviews: - id: 13646 title: "Pro/File 2068" type: "product" url: "http://localhost/product/pro-file-2068-2/" archive_link: false --- # SUM routine I needed a different type of routine for number crunching instead of the TALLY routine. Basically, I needed an entire line to be treated as one value instead of half and half, and 1 needed some of the answer printed out if necessary. The following is the result. I call it the SUM routine and it is designed to accept numeric data on line 15 (last line). The restrictions on what type of characters can be used as numeric information is the same as for the tally routine. I use it to keep track of each student’s credit for a trip to Florida. Since many fundraising projects are required, I needed a full line to handle it all. The line gives the profit on each project so if line 15 shows this: ``` 15.95+20+0+40.1+50 ``` that would mean the student has made the following profit: ``` 15.95 cheese sale 20.00 candy sale 00.00 car wash 40.10 fruit sale 50.00 cash payment ``` for a total of $126.05. This total would be shown in SUM2. SUM1 would show the combined profit of all found files. When printed out, SUM2 would be printed after the last line set up by the DEFP command. If you want a space between each file, put the space FIRST instead of last or the SUM2 will be printed after the space and right above the next file. Example: use 0/1 instead of 1/0. Activate the routine with the reverse slash followed by S. ``` 150 LET B=USR VAL "64101": CLS : IF J$="S" AND Y AND T1 THEN LPRINT T0 1049 LET T0=T0-(T0 AND J$="S): IF E$(U, TO VAL "18")<>D$(H TO J+F) AND CODE J$>Q THEN GO TO VAL "8500"+CODE J$ 7225 NEXT X: IF J$="S" AND Y$="C" THEN LPRINT T0 7229 IF J$="T" OR J$="S" THEN GO TO VAL "1049"+(Y$="C) 7235 IF Y AND A=O THEN GO TO J*K 8582 GO TO U 8583 GO TO VAL "9250" 9105 PRINT A J,O;"CNT=";T1;: IF J$="T" OR J$="S" THEN PRINT " SUM1=";T;" SUM2=";T0 9200 POKE VAL "63798",J+U: LET E$(U,U)=E$(U,U): IF USR VAL "63792" THEN LET T=T+VAL E$(U, TO J+U) 9210 IF Y AND (J$="T" OR J$="S") THEN GO TO J*K 9250 POKE VAL "63798",Q: LET E$(J,U)=E$(J,U): IF USR VAL "63792" THEN LET T=T+VAL E$(J): LET T0=VAL E$(J) 9260 GO TO VAL "9210" ```