Skip to content
Social Security Online
Benefit Calculator
Office of the Chief Actuary SSA logo: link to Social Security Online home

Source Code for the Social Security Benefit Calculator

Detailed Calculator Home

Versions of the program

There are two versions of the Social Security Benefit Calculator: one for Win32 (Windows 98, NT, ME, 2000, XP, Server 2003, or Vista) and one for the MacOS. The version for Win32 is compiled using the Microsoft Visual C/C++ compiler (.NET version). The version for the MacOS is compiled using the Metrowerks CodeWarrior compiler (version 9.0).

A PC with ANYPIA on screen

Source code for the calculator

The source code that does the actual benefit calculations is stored in subdirectories oactobjs (for the MacOS) and oactobjs32 (for Win32). In addition there are extra files in each subdirectory saved by the compiler to help the compiler build the libraries; those files differ from Win32 to MacOS.

The source code for the windowing part of the program is stored in subdirectories anypiamacprojOSX (for the MacOS) and anypia32 (for Win32). There is also a subdirectory anypiab with source code to make a console application; it uses the Win32 calculation code. (See Batch Version of the Calculator for more details.)

You can download the MacOS calculation and windowing code (subdirectories oactobjs and anypiamacOSXproj), and/or the Win32 calculation and windowing code (subdirectories oactobjs32, anypia32, and anypiab). The code for the MacOS is available as .sit archives. The Windows code is available as self-extracting zipped files (executable on a Win32 machine) or as plain zip files (which can be expanded on any operating system with unzip capabilities).

Downloading Win32 source code

To download the Win32 code, click one item from each of the following rows:

Source files

Self-extracting zip file

Plain zip file

oactobjs32

oactobjs32.exe (664,807 bytes)

oactobjs32.zip (595,086 bytes)

anypia32 and anypiab

source32.exe (223,788 bytes)

source32.zip (154,067 bytes)

Downloading MacOS source code

To download the MacOS code, click on each of the following items:

Source files

Archive file (.sit)

oactobjs

oactobjs.sit (539,315 bytes)

anypiamacproj

anypiamacprojOSX.sit (223,124 bytes)

The Boost Libraries

In the 2006.2 and later versions of the code, we use the Boost libraries, which are a set of free open-source libraries that perform common functions not included in the C++ Standard Library. In order to use our source code, you will have to download and install the libraries, version 1.33.1, from www.boost.org. That website has instructions on how to install the libraries on your computer.

In your C++ projects for each of the libraries in our source code and the main program project, you must put an include path to the base of your Boost install directory. Here's where we have boost installed in the ready-made projects we include with our source code: On a Windows machine, the libraries are in a subdirectory of oactobjs32 named "boost_1_33_1". On a Mac, the libraries are in a directory parallel to oactobjs and anypiamacprojOSX named "boost_1_33_1". Once this is done, you can use our projects to build the program.

The oactobjs directory (for MacOS)

oactobjs contains 182 include files (ending in .h) and four subdirectories with library source code. The first subdirectory, miscproj, contains 37 files (ending in .cpp) for classes that are not tied specifically to Social Security benefit calculations. The second subdirectory, piadataproj, contains 149 files (ending in .cpp) for classes involving benefit calculations. The third subdirectory, piaoutproj, contains 38 include files (ending in .h) and 38 files (ending in .cpp) for classes involving printing out the results of a benefit calculation. The fourth subdirectory, mac, contains six header files (ending in .h) and one file (ending in .cpp) for functions which are not available in MacOS, or that differ from similar functions on other operating systems. The code in all four subdirectories has only been tested with the Metrowerks compiler within the MacOS environment.

The oactobjs32 directory (for Win32)

oactobjs32 contains five subdirectories with library source code. The first subdirectory, windows, contains 15 include files (ending in .h), 5 C files (ending in .c) and 4 C++ files (ending in .cpp) for functions that are not available with the Windows operating system, or that differ from similar functions on other operating systems. The second subdirectory, misc, contains 29 files (ending in .cpp) for classes that are not tied specifically to Social Security benefit calculations. The third subdirectory, piadata, contains 148 files (ending in .cpp) for classes involving benefit calculations. The fourth subdirectory, piaout, contains 38 include files (ending in .h) and 38 files (ending in .cpp) for classes involving printing out the results of a benefit calculation. The fifth subdirectory, include, contains 175 header files (ending in .h). In addition, each subdirectory except include contains a solution file (ending in .sln) and a project file (ending in .vcproj) that work with the Microsoft compiler, .NET version, to create each library. However, the code in the three subdirectories other than windows has been compiled on the Linux operating system using the Gnu C++ compiler, where the subdirectory linux takes the place of the subdirectory windows.

The anypiamacprojOSX directory

anypiamacprojOSX contains five subdirectories: one with the user interface code for the MacOS version of the benefit calculation program, one with resource files, one with information for prebuilding include files, one for target information, and one for output. The subdirectory named Source contains 33 include files (ending in .h), 31 files with class functions (ending in .cp or .cpp), and 1 file with utility functions (ending in .c). The subdirectory named Resources contains 10 files for icons and visual layout information. The subdirectory named Prefix contains 3 files for prebuilding include files. The directory anypiamacData is empty, but will contain target information after the project has been opened in CodeWarrior. The directory Output will contain the executable file when the program is built.

The anypiab directory

anypiab contains the necessary files to make a console application (MS-DOS executable) that reads either one file with multiple cases or multiple individual data files and calculates the benefit for each case (see Batch Version of the Calculator). There are 3 include files (ending in .h), 3 files with C++ code (ending in .cpp), a solution file (anypiab.sln) and a project file (anypiab.vcproj) for compiling with the Microsoft compiler, .NET version, and two illustrative data files (anypiab.pia and anypiac.dat). The solution references three libraries in the oactobjs32 directory (windows, misc, and piadata), so those libraries need to be made before compiling the files in this subdirectory. There is a macro named DETAILS which can be defined to allow anypiab to produce detailed output. If it is defined, the fourth library (piaout) must also be made before compiling the files in this subdirectory. The anypiab program has been compiled on other operating systems, including Linux using the Gnu C++ compiler with the linux library replacing the windows library.

The anypia32 directory

anypia32 contains the user interface code for the Win32 version of the Calculator and one subdirectory with resource files. There are 40 include files (ending in .h), 39 files with class functions (ending in .cpp), a resource file (anypia32.rc), a solution file (anypia32.sln), a project file (anypia32.vcproj), and a help macro file (resource.hm). The subdirectory res contains 4 files for icons and bitmaps. The solution references the four libraries in the oactobjs32 subdirectory and the Boost libraries, so those libraries need to be made before compiling the files in this subdirectory.

Compilers

The source code, as distributed, may not compile correctly with compilers other than those mentioned above. The author will provide limited assistance to anyone trying to recompile the program with another compiler or in another operating system.

Documentation

We provide descriptions of the functions available in the oactobjs32 libraries in a Microsoft compiled HTML file. To download the documentation, click the following item:

Source documentation

Compiled HTML file

oactobjs

oactobjsdoc.chm (2,303,235 bytes)

Creating a program with changes from present law

A version of the interactive or console program that can handle some changes from present law can be created by using the LawChangeArray created on line 67 of anypiabdoc.cpp (for the console version) or line 186 of AnypiaDoc.cpp (for the Win32 interactive version). Note, however, that only some of the 40 listed changes from present law have actually been implemented. Also note that there is not yet any user interface code to handle the indicators for changes from present law.

Program in Fortran

We also have a Social Security benefit estimate program program in Fortran, the operation of which is similar to that of the C++ version. The Fortran source code is structured similarly to the C++ version, but has not been updated for some years. The source code for the program, or the program compiled for MS-DOS, is available in a self-extracting zipped file sourcef.exe (384,000 bytes), or in a plain zipped file, sourcef.zip (358,085 bytes).

The program compiles in Windows 98 or NT, using Compaq Fortran. There are also separate files of subroutines enabling the program to compile on a Unix system or on an IBM mainframe. However, the compiled program does not have some of the screen-handling capabilities of the C++ version; therefore we distribute the C++ version, rather than the Fortran version, as the Calculator.

Questions or comments

Questions or comments about the Detailed Calculator? Be sure to specify the "Detailed Calculator" in your message so we know to which calculator your question or comment refers.

 USA.gov: Portal to U.S. government agencies Privacy Policy  | Website Policies & Other Important Information  | Site Map
Last reviewed or modified Fri May 2, 2008
Need Larger Text?