Rule Definition
The internal COBOL sort function is known as being inefficient on zOS environment (this is the same problem with the merge function). It is often recommended to use external sort tools to process files which can contain a large number of records. Usually required in batch processing the sort tools are generally called by a previous step in the JCL running the program.
Using the internal Cobol sort function rather than external sort tool can affect perceptibly the performance of applications in terms of data manipulation.
Remediation
Remove all unnecessary SORT action and replace them by external SORT.
Violation Code Sample
IDENTIFICATION DIVISION.
PROGRAM-ID. COBFUNC1.
...
SORT SORT-FILE
ON ASCENDING KEY WORKDEPT
USING EMPDATA
GIVING OUTFILE
...
Fixed Code Sample
//SORGDG EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DISP=SHR,DSN=MYTELCO.COBDYNSQ.GDG(0)
//SORTOUT DD DSN=MYTELCO.SORTOUT,DISP=(NEW,PASS,DELETE),
// DCB=(LRECL=80,BLKSIZE=0,DSORG=PS,RECFM=FB),
// SPACE=(CYL,(5,5)
//SYSIN DD *
SORT FIELDS=(1,6,CH,A)
SUM FIELDS=NONE
/*
//COBOL1 EXEC PGM=COBFUNC1
//STEPLIB DD DSN=APPCAST.SOURCE.LOADLIB
//SORT01 DD DSN=MYTELCO.SORTOUT
//VSAMF DD DSN=MYTELCO.EMPDATA.VSAM,DISP=SHR
//SEQTF DD DSN=MYTELCO.COBFUNC1.SEQ1,DISP=(NEW,CATLG,DELETE),
// DCB=(LRECL=120,BLKSIZE=0,DSORG=PS,RECFM=FB)
// SPACE=(TRK,(5,5))
Related Technologies
Cobol
Technical Criterion
Efficiency - SQL and Data Handling Performance
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.