Questions tagged [subroutine]

A subroutine (e.g. procedure or subprogram) is a portion of code within a larger program, which performs a specific task and can be relatively independent of the remaining code. The syntax of many programming languages includes support for creating self contained subroutines, and for calling and returning from them. They are in many ways similar to functions, but usually have side-effects outside of the simple "return value" that functions return.

Filter by
Sorted by
Tagged with
1
vote
1answer
57 views

How to break my code into subroutines? - Java

I have written a code for data management and parallel arrays but it has to be broken into methods/subroutines. Whenever I try to do so, some aspect of my code stops working. Would it be possible for ...
1
vote
1answer
38 views

Populates Data from one Workbook to Another

Another code clean up I am working on. I have been breaking up my code based on things I have learned here on CR. The code below all works and functions as expected, but I know it can be streamlined ...
2
votes
3answers
94 views

Using buttons to trigger a Sub Procedure in Excel, this will split/copy data into a second sheet in the same workbook

I currently have an Excel workbook which pulls data from a website that lists sign language interpreters from here. There are 7 different regions, or tables, I pull from. The data is put into Sheet1, ...
2
votes
2answers
44 views

Resolve dependencies from output of PBS queueing system

I have written a script, that reformats the output of qstat -f1 of the PBS queueing system. Unfortunately this project is by far too big to post here complete, also ...
2
votes
1answer
37 views

Read group of keywords from file, modify value, store new group to variable

I would like to use the following routine in my submission script for GAMESS calculations. I am not entirely sure if this is the optimum way to go. This function would need one of the messaging ...
4
votes
1answer
51 views

Checking if input file exists, assign output file destination, prevent overwriting any files

I would like to use the following routines in my submission script for GAMESS calculations. Before I do, I would like to get some input if I can improve it somehow. The three messaging routines (<...
5
votes
2answers
953 views

List all repeated substrings with a fixed length

While fiddling around, I've made a very simple and naive function to retrieve any repeated sub-string within a certain string. ...
2
votes
1answer
653 views
2
votes
1answer
107 views

Improving efficiency and flow by changing subroutine orders

A batch file executes WinSCP.exe's console mode to download files and log the actions. Upon exit, WinSCP returns: ERRORLEVEL 0 if the files are successfully ...
1
vote
0answers
209 views

Split large import task into smaller subtasks

I have a large import task that runs as a cronjob and I want to split that task in smaller subtasks. Each subtask should be handled by an own class. At the cronjob entry point I prepare the import-...
3
votes
2answers
165 views

Verb tense parser

I have written this Perl code, and there is still more to add, however I was hoping that I could get some opinions on whether it could be written better. Specifically, there is a central ...
4
votes
2answers
317 views

Is calling a function only twice a good use of recursion?

Is this, technically, a recursive function? It only gets called once by itself, but it cleaned up my code quite a bit, I think. Or, does it needlessly complicate the code? ...
14
votes
4answers
533 views

Subroutine to call other subroutines

I have a Perl application that allows the user to choose between two different formats for data output (and there will likely be more in the near future). In the heart of the algorithm, the code makes ...