Sample Source Code
Sample Source Code


Below are sample source code files.

Sample Description
accept.cblHow to get the system date and time, and how to capture standard input.
arithmetic.cblBasic arithmetic commands (ADD, SUBTRACT, MULTIPLY, DIVIDE.
banner.cblHow to display a Unix-style banner.
cal.cblHow to display a calendar for a given month and year.
call.cblHow to call an external application.
client.cblTCP/IP client example . use with SERV.CBL.
compute.cbl Different forms and uses of the COMPUTE statement, and the use of expressions.
convfuncs.cbl Metric system to English system and English to metric conversion functions.
copy.cbl How to include copybooks with the COPY command.
COPYBOOK.CPY Example COPYBOOK
COPYBOOK.INC Example COPYBOOK
count.cbl Return number of emails in an email account.
display.cbl How to display different forms of output to the standard output device.
dynfile.cbl Dynamic file creation example.
execute.cbl How to use the EXECUTE command to dynamically execute statements.
financefuncs.cbl Financial calculation and depreciation functions.
ftp.cbl File Transfer Protocol commands.
f_exec.cbl A file processing example that uses the EXECUTE command.
geomfuncs.cbl Trigonometric functions (sine, cosine, inverses, hyperbolics, etc).
getban.cbl How to save a Unix-style banner to a variable.
getcal.cbl How to save a calendar for a given month and year to a variable.
getcmdline.cbl Retrieve command line arguments.
getenv.cbl How to retrieve environmental variables from the operating system.
gethn.cbl Use of GETHOSTNAME command.
gettime.cbl Use of GETTIMEFROMSERVER command.
gm.cbl Get email example source code.
goback.cbl How to terminate a program using GOBACK.
hmathfuncs.cbl Higher math functions (logs, natural logs, rounding, roots, etc).
if.cbl IF conditions.
init.cbl How to initialize variables.
lower.cbl Lowercase example.
ltrim.cbl Left Trim example.
mail.cbl How to send simple emails, retrieve emails, and get count of emails on an SMTP server.
move.cbl Use of the MOVE statement.
occurs.cbl How to use the OCCURS clause.
openclse.cbl How to open and close files.
oper.cbl Examples of operator usage.
perform.cbl Use of the PERFORM statement.
pic.cbl Picture clause example usage.
position.cbl How to use the POSITION statement to position to a particular record in a text data file.
probfuncs.cbl Probability functions (random number generator, factorials, etc).
profoccr.cbl Professional Edition OCCURS clause example.
rb.cbl Reading Blocks of text.
read.cbl How to read data from files.
reccopy.cbl Read and Write file example.
replica.cbl How to use the REPLICA clause.
rewrite.cbl How to use the REWRITE statement to update records in a text data file.
rtrim.cbl Right Trim example.
serv.cbl TCP/IP server example . use with CLIENT.CBL.
set.cbl e of SET statement.
shm1.cbl Shared Memory programming example 1.
shm2.cbl Shared Memory programming example 2.
size.cbl Determine size in bytes of an email.
sm.cbl Send email example.
sql.cbl Professional Edition SQL example.
sql.cpy SQL return variable copybook.
stoprun.cbl How to terminate a program using STOP RUN.
tcpip.cpy TCP/IP return variable copybook.
tok.cbl String tokenizing example.
trim.cbl String trim example.
upper.cbl Upper Case conversion example.
web.cbl How to retrieve web pages and save them to a file.
write.cbl How to write data to a file.
WRITE1.DAT write.cbl data file.
write2.dat write.cbl data file.

Copyright © 1996-2025 Matt Dean