Recently I tried to replace an Easytrieve program with SYNCSORT for performance reasons.
The below Easytrieve program was running for 6 minutes and it issued 1,051,382 EXCP’s and consumed 15.84 CPU seconds.
The input file had about 60 million records.
FILE FILEIN
IN-REC 1 244 A
IN-FIELD1 212 1 A
IN-FIELD2 213 11 N 4
IN-FIELD3 224 5 N
IN-FIELD4 229 11 N 4
IN-FIELD5 240 5 N
IN-REC 1 244 A
IN-FIELD1 212 1 A
IN-FIELD2 213 11 N 4
IN-FIELD3 224 5 N
IN-FIELD4 229 11 N 4
IN-FIELD5 240 5 N
FILE FILEOUT FB(0 0)
OUT-REC 1 246 A
OUT-FIELD1 212 3 A
OUT-FIELD2 215 11 N 4
OUT-FIELD3 226 5 N
OUT-FIELD4 231 11 N 4
OUT-FIELD5 242 5 N
JOB INPUT FILEIN
*
OUT-REC = IN-REC
*
IF IN-FIELD1 = ' '
OUT-FIELD1 = ' '
ELSE
OUT-FIELD1 = 'XXX'
END-IF
*
OUT-FIELD2 = IN-FIELD2
OUT-FIELD3 = IN-FIELD3
OUT-FIELD4 = IN-FIELD4
OUT-FIELD5 = IN-FIELD5
*
PUT FILEOUT
OUT-REC 1 246 A
OUT-FIELD1 212 3 A
OUT-FIELD2 215 11 N 4
OUT-FIELD3 226 5 N
OUT-FIELD4 231 11 N 4
OUT-FIELD5 242 5 N
*
OUT-REC = IN-REC
*
IF IN-FIELD1 = ' '
OUT-FIELD1 = ' '
ELSE
OUT-FIELD1 = 'XXX'
END-IF
*
OUT-FIELD2 = IN-FIELD2
OUT-FIELD3 = IN-FIELD3
OUT-FIELD4 = IN-FIELD4
OUT-FIELD5 = IN-FIELD5
*
PUT FILEOUT
I created below SORT card to replace the above program. SORT step completed in 2 minutes 45 seconds.
It issued 58,423 EXCPs and consumed 25.10 CPU seconds.
OPTION COPY
INREC IFTHEN=(WHEN=(212,1,CH,EQ,C' '),
BUILD=(1:1,211,C' ',213,32)),
IFTHEN=(WHEN=NONE,
BUILD=(1:1,211,C'BER',213,32))
EZT program | SORT | EZT program | SORT | EZT program | SORT |
CPU time | CPU time | Elapsed time | Elapsed time | IO count | IO count |
15.84 seconds | 25.1 seconds | 00:05:31 | 00:02:45 | 1,051,382 | 58,423 |
Though SORT has beaten EZT program by elapsed time, it could NOT beat when it comes to CPU time.
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.