000001 /* REXX */
000002
000003 "EXECIO * DISKR IN (stem p. FINIS"
000004 say 'Number of input records is' p.0
000005 LastRec = p.0
000006
000007 /*************************************************/
000008
000009 Do rec=1 to p.0
000010 IF POS('IEE459I',p.rec) > 0 then call report /* call subroutine */
000011 END
000012
000013
000014 "EXECIO 0 DISKR IN (FINIS"
000015 "EXECIO 0 DISKW OUT (FINIS"
000016 "free file(in)"
000017 "free file(out)"
000018 /**************************************************/
000019 Exit 0
000020 /**************************************************/
000021
000022 report:
000023 i = 1
000024 DO FOREVER
000025 rec = rec + 1
000026 IF POS('DEV-SERIAL',p.rec) > 0 then iterate
000027 IF POS('****',p.rec) > 0 then LEAVE
000028 serial.i = WORD(p.rec,8) /* Dev-Serial Number */
000029 cylinder.i = WORD(p.rec,5) /* Each Cylinders */
000030 cylinder.i = strip(cylinder.i,'T','*')
000043 info = serial.i cylinder.i
000044 i = i + 1
000045 say info
000046 w.1 = INFO
000047 "EXECIO 1 DISKW OUT (stem w."
000048 END
000049 return
000002
000003 "EXECIO * DISKR IN (stem p. FINIS"
000004 say 'Number of input records is' p.0
000005 LastRec = p.0
000006
000007 /*************************************************/
000008
000009 Do rec=1 to p.0
000010 IF POS('IEE459I',p.rec) > 0 then call report /* call subroutine */
000011 END
000012
000013
000014 "EXECIO 0 DISKR IN (FINIS"
000015 "EXECIO 0 DISKW OUT (FINIS"
000016 "free file(in)"
000017 "free file(out)"
000018 /**************************************************/
000019 Exit 0
000020 /**************************************************/
000021
000022 report:
000023 i = 1
000024 DO FOREVER
000025 rec = rec + 1
000026 IF POS('DEV-SERIAL',p.rec) > 0 then iterate
000027 IF POS('****',p.rec) > 0 then LEAVE
000028 serial.i = WORD(p.rec,8) /* Dev-Serial Number */
000029 cylinder.i = WORD(p.rec,5) /* Each Cylinders */
000030 cylinder.i = strip(cylinder.i,'T','*')
000043 info = serial.i cylinder.i
000044 i = i + 1
000045 say info
000046 w.1 = INFO
000047 "EXECIO 1 DISKW OUT (stem w."
000048 END
000049 return
The output of the program above is
0113-23040 600
0113-23040 600
0175-W4941 1668
0113-23040 250
0175-W4941 1200
0175-W4941 1200
But I am looking for a summary of above like
DEV-SERIAL VOLUMES CYL
0113-23040 3 1450
0175-W4941 3 4068
I tried nested loop but no success, any direction or pseudo code would be appreciable.