program subeoftst, 1.0(100) ! test SUBMIT breaking EOF / INPUT !------------------------------------------------------------------------ !EDIT HISTORY !Version 1.0:- ! [100] 21-Nov-24 / jdm / created !------------------------------------------------------------------------ !REQUIREMENTS ! !NOTES ! Attempt to reproduce problem reported by Rene at ASFM where ! reading an input file loops back to the beginning rather than ! triggering EOF, IFF XCALL SUBMIT is called in between each input. !------------------------------------------------------------------------ ++include'once ashinc:ashell.def MAP1 GLOBALS MAP2 PLINE,S,100 MAP2 COUNT,B,2 MAP2 PID,B,4 MAP2 STDIN$,S,100 MAP2 STDOUT$,S,100 MAP2 STDERR$,S,100 MAP2 EXEC$,S,100 MAP2 I,I,2 MAP2 SBRFLAGS,B,4 MAP2 A,B,1 ? .PGMNAME;" version "; .PGMVERSION; " - test EOF and SUBMIT" xcall MIAMEX, MX_SBRFLG, MXOP_GET, SBRFLAGS if SBRFLAGS and SBRF_SUBMIT2 then A = 1 input "SBR=SUBMIT2 option is SET; enter 0 to disable: ",A if A = 0 then xcall MIAMEX, MX_SBRFLG, MXOP_SET, SBRFLAGS and not SBRF_SUBMIT2 ? "SBR=SUBMIT2 disabled" endif else A = 0 input "SBR=SUBMIT2 option is NOT set; enter 1 to enable: ",A if A then xcall MIAMEX, MX_SBRFLG, MXOP_SET, SBRFLAGS or SBRF_SUBMIT2 ? "SBR=SUBMIT2 enabled" endif endif ! create a file listing several existing files to use for input ? "Building list of SUB* files to use for testing ..." xcall AMOS,"SYS:ERASE.LIT SUB*.OUT",1,1 xcall AMOS,"SYS:DIR.LIT SUBEOFTST.DAT=SUB*/1/NA",1,1 ? "Here's the list ..." open #888, "SUBEOFTST.DAT", input do while eof(888) = 0 input line #888, PLINE if PLINE # "" then COUNT += 1 ? COUNT, PLINE endif loop ? COUNT;" lines total" close #888 open #1,"SUBEOFTST.IN", output ! create dummy stdin file close #1 ? "Test consists of submitting each to md5sum, outputting to .out" input "Enter to start test: ",PLINE COUNT = 0 open #888, "SUBEOFTST.DAT", input do while eof(888) = 0 input line #888, PLINE if PLINE # "" then COUNT += 1 ? COUNT, "EOF=";EOF(888), PLINE; ! skip the output files created by md5sum ... if instr(1,PLINE,".out") then ? " " repeat else ? endif I = instr(1,PLINE,".") STDIN$ = "SUBEOFTST.IN" STDOUT$ = PLINE[1,I] + "out" STDERR$ = STDOUT$ xcall SUBMIT, PID, STDIN$, STDOUT$, STDERR$, "/usr/bin/md5sum", PLINE endif loop ? "EOF reached after ";COUNT;" lines" xcall MIAMEX, MX_SBRFLG, MXOP_SET, SBRFLAGS ! restore original option ? "Output files:" ! give the submitted commands a chance to complete ! (note that sleep will be interrupted by completion of sub-task if not SUBMIT2) sleep 3 xcall AMOS, "SYS:DIR.LIT/LT/P SUB*.OUT",0,1 end