Also your REXX code is somewhat inefficient, you are writing out EXECIO DISKW when you could QUEUE the result and write them all at the end, using QUEUED().
I beg to disagree, or better REXX disagrees
using queue results in a double data movement
queue ==> <write> to the stack
execio ==> <read> from the stack, <write> to the file
here is the result of my tests from best to worst
1) EXECIO the stem with all the records
2) QUEUE all RECORDS / execio
3) EXECIO each record
4) QUEUE & EXECIO each record
all the test were run writing 100000 records
case 1 fill the stem, one execio for the whole stem
000008 /* REXX */
000009 parse arg imax
000010 zi = time()
000011 ze = time("e")
000012 buff.0 = 1
000013 buff.1 = "some data"
000014 do i = 1 to imax
000015 buff.i = "some data"
000016 end
000017 address tso "execio " imax " diskw outfile (stem BUFF."
000018 say "started" zi
000019 say "ended " time()
000020 say "elaps " time("e")
000021 exit
HTRT05I ------------------------------------------------------------------------
- Step Termination Statistics -
- -
- Program Name IKJEFT01 hh:mm:ss.th -
- Step Name IKJ Elapsed Time 16.71 -
- Procedure Step TCB CPU Time 14.79 -
- Return Code 00 SRB CPU Time 00.01 -
- Total I/O 327 Total CPU Time 14.80 -
- Service Units 636K -
- -
- Region Size 1024K Pages Paged 0 -
- Data/Hiperspace 0M Pages Swapped 0 -
- ASID Swaps 0 Pages Stolen 0 -
- VIO (In and Out) 1 -
- -
- --------Below 16Meg-------- --------Above 16Meg-------- -
- Private Area 9192K Private Area 1801216K -
- Max Allocated 204K Max Allocated 5572K -
- LSQA And SWA 348K LSQA And SWA 10972K -
- -
- DDName Unit Blksize I/O -
- SYSEXEC VIO 27920 2 -
- *System* 325 -
- -
------------------------------------------------------------------------
started 00:04:28
ended 00:04:43
elaps 14.179206
case 2 ) queue all the records, one execio for all the records queued
000008 /* REXX */
000009 parse arg imax
000010 zi = time()
000011 ze = time("e")
000012 buff.0 = 1
000013 buff.1 = "some data"
000014 do i = 1 to imax
000015 queue buff.1
000016 end
000017 address tso "execio * diskw outfile "
000018 say "started" zi
000019 say "ended " time()
000020 say "elaps " time("e")
000021 exit
HTRT05I ------------------------------------------------------------------------
- Step Termination Statistics -
- -
- Program Name IKJEFT01 hh:mm:ss.th -
- Step Name IKJ Elapsed Time 27.01 -
- Procedure Step TCB CPU Time 24.15 -
- Return Code 00 SRB CPU Time 00.01 -
- Total I/O 328 Total CPU Time 24.16 -
- Service Units 1038K -
- -
- Region Size 1024K Pages Paged 0 -
- Data/Hiperspace 0M Pages Swapped 0 -
- ASID Swaps 0 Pages Stolen 0 -
- VIO (In and Out) 1 -
- -
- --------Below 16Meg-------- --------Above 16Meg-------- -
- Private Area 9192K Private Area 1801216K -
- Max Allocated 204K Max Allocated 5572K -
- LSQA And SWA 348K LSQA And SWA 11048K -
- -
- DDName Unit Blksize I/O -
- SYSEXEC VIO 27920 2 -
- *System* 326 -
- -
------------------------------------------------------------------------
started 00:04:00
ended 00:04:27
elaps 26.768784
case 3 one execio for each record
000008 /* REXX */
000009 parse arg imax
000010 zi = time()
000011 ze = time("e")
000012 buff.0 = 1
000013 buff.1 = "some data"
000014 do i = 1 to imax
000015 address tso "execio 1 diskw outfile (stem buff."
000016 end
000017 say "started" zi
000018 say "ended " time()
000019 say "elaps " time("e")
000020 exit
HTRT05I ------------------------------------------------------------------------
- Step Termination Statistics -
- -
- Program Name IKJEFT01 hh:mm:ss.th -
- Step Name IKJ Elapsed Time 49.95 -
- Procedure Step TCB CPU Time 45.44 -
- Return Code 00 SRB CPU Time 00.01 -
- Total I/O 327 Total CPU Time 45.45 -
- Service Units 1954K -
- -
- Region Size 1024K Pages Paged 0 -
- Data/Hiperspace 0M Pages Swapped 0 -
- ASID Swaps 0 Pages Stolen 0 -
- VIO (In and Out) 1 -
- -
- --------Below 16Meg-------- --------Above 16Meg-------- -
- Private Area 9192K Private Area 1801216K -
- Max Allocated 204K Max Allocated 360K -
- LSQA And SWA 348K LSQA And SWA 10972K -
- -
- DDName Unit Blksize I/O -
- SYSEXEC VIO 27920 2 -
- *System* 325 -
- -
------------------------------------------------------------------------
started 00:01:11
ended 00:02:00
elaps 49.729041
case 4 ) queue each record, one execio for each record queued
000008 /* REXX */
000009 parse arg imax
000010 zi = time()
000011 ze = time("e")
000012 buff.0 = 1
000013 buff.1 = "some data"
000014 do i = 1 to imax
000015 queue buff.1
000016 address tso "execio * diskw outfile "
000017 end
000018 say "started" zi
000019 say "ended " time()
000020 say "elaps " time("e")
HTRT05I ------------------------------------------------------------------------
- Step Termination Statistics -
- -
- Program Name IKJEFT01 hh:mm:ss.th -
- Step Name IKJ Elapsed Time 01:19.77 -
- Procedure Step TCB CPU Time 01:11.75 -
- Return Code 00 SRB CPU Time 00.01 -
- Total I/O 327 Total CPU Time 01:11.76 -
- Service Units 3086K -
- -
- Region Size 1024K Pages Paged 0 -
- Data/Hiperspace 0M Pages Swapped 0 -
- ASID Swaps 0 Pages Stolen 0 -
- VIO (In and Out) 1 -
- -
- --------Below 16Meg-------- --------Above 16Meg-------- -
- Private Area 9192K Private Area 1801216K -
- Max Allocated 204K Max Allocated 360K -
- LSQA And SWA 348K LSQA And SWA 10972K -
- -
- DDName Unit Blksize I/O -
- SYSEXEC VIO 27920 2 -
- *System* 325 -
- -
------------------------------------------------------------------------
started 00:02:40
ended 00:04:00
elaps 79.552926