Sorting Assignment


Sorting is very easy in COBOL. This lab will be the shortest COBOL we have written.

Sort the salary / gender / marital status data file on:

1) marital status (M, S) in - descending order
2) the gender (M F) - regular order
3) the name

The data file has the following specifications:

columns 1 - 4 - Employee ID number (not used)
columns 5 - 16 - Employee First name (not used)
columns 17 - 31 - Employee Last name (not used)
columns 32 - 36 - Employee gross salary (pic 9(5))
column 37 - Marital status (S - single; M - married)
column 38 - Gender (F - female; M - male)


 

Here is the original data file (used previously)

Here is the output (looks similar - but check out the maritial status column, gender and the name columns)


 

Sample Sorting code

 

Back to COBOL I main page