I think I found a bug in EXECIO when using the STEM option. When I use the same variable to catch the CP output, it works the first time, but not after that. I have tried initializing the stem variable each time I use it, and not initializing it. Neither helps. Remove CPinfo. = '' from the EXEC, found at the bottom, to see for yourself. The following is the output of performing this task manually. Hence I don't use the STEM option., but I do get CP output.
q rdr *
NO RDR FILES
Ready; T=0.01/0.01 08:10:08
cp query virtual 00c
RDR? 00C CL A? NOCONT NOHOLD?? EOF????? READY
Ready; T=0.01/0.01 08:10:19
SPOOL CONSOLE START TO * TERM
Ready; T=0.01/0.01 08:10:31
scan GCC EXEC Y2
Enter pattern:
&ARGS
?
File: GCC EXEC Y2.
?16:
&ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
?22:
&ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
?28:
&ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
?35:
?? &ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
?61:
?? &ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
?88:
?? &ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
Ready; T=0.01/0.02 08:10:41
SPOOL CONSOLE STOP CLOSE TERM
CON FILE 1758? TO? XMAS???? COPY 01 NOHOLD
Ready; T=0.01/0.01 08:10:48
q rdr *
ORIGINID FILE CLASS RECDS? CPY HOLD
XMAS???? 1758 T CON 000020? 01 NONE
Ready; T=0.01/0.01 08:10:55
The following is the output from PARS EXEC, which is at the bottom of this missive. The stem variable, CPinfo. , only contains results the first time. Hence, I don't catch a spool ID for the closed console file.
Another odd thing, is that the console spool file seems vanish upon closing. I tried a manual STOP CLOSE, and still nothing.
If the spool ID were to show up, then I could process the file.
q rdr *
ORIGINID FILE CLASS RECDS? CPY HOLD
XMAS???? 1758 T CON 000020? 01 NONE
Ready; T=0.01/0.01 08:12:14
pars
QUERY VIRTUAL 00C
CPinfo.0? =? 1
CPinfo.1? =? RDR? 00C CL A? NOCONT NOHOLD?? EOF????? READY
SPOOL CONSOLE START TO * TERM
CPinfo.0? =
Enter pattern:
?
File: GCC EXEC Y2.
?16:
&ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
?22:
&ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
?28:
&ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
?35:
?? &ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
?61:
?? &ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
?88:
?? &ARGS &2 &3 &4 &5 &6 &7 &8 &9 &10 &11 &12 &13 &14 &15 &16 &17 &18 &19 &20
SPOOL CONSOLE STOP CLOSE TERM
CPinfo.0? =
Spool ID:
Error: SpoolID () not valid.
Ready(00008); T=0.04/0.06 08:12:1
q rdr *
ORIGINID FILE CLASS RECDS? CPY HOLD
XMAS???? 1758 T CON 000020? 01 NONE
Ready; T=0.01/0.01 08:12:24
SPOOL CONSOLE STOP CLOSE TERM
Ready; T=0.01/0.01 08:23:59
q rdr *
ORIGINID FILE CLASS RECDS? CPY HOLD
XMAS???? 1758 T CON 000020? 01 NONE
Ready; T=0.01/0.01 08:24:07
Below is the EXEC. It's longer than it would be if everything was working correctly. I have tried to be consistent in usage and catch all the information I could.
//
ADDRESS 'COMMAND'????????????????????? /* Strict command evaluation.? */
SIGNAL ON SYNTAX?????????????????????? /* Handle syntax errors.?????? */
SIGNAL ON NOVALUE????????????????????? /* Handle bad/no value errors. */
fn = 'GCC'
ft = 'EXEC'
fm = 'Y'
//
/* Scan specified file for string and place results in RDR spool file */
//
CPinfo. = ''
CP_Command = 'QUERY VIRTUAL 00C'
SAY CP_Command
'EXECIO * CP ( STEM CPinfo. STRING ' CP_Command ' )'
Counter = 0
DO UNTIL Counter > CPinfo.0
?? SAY 'CPinfo.'Counter ' = ' CPinfo.Counter
?? Counter = Counter + 1
END
//
New_Class = 'T'
CPinfo. = ''
CP_Command ='SPOOL CONSOLE START TO * TERM'
SAY CP_Command
'EXECIO * CP ( STEM CPinfo. STRING ' CP_Command ' )'
Counter = 0
DO UNTIL Counter > CPinfo.0
?? SAY 'CPinfo.'Counter ' = ' CPinfo.Counter
?? Counter = Counter + 1
END
New_Class = 'T'
CPinfo. = ''
CP_Command ='SPOOL CONSOLE START TO * TERM'
SAY CP_Command
'EXECIO * CP ( STEM CPinfo. STRING ' CP_Command ' )'
Counter = 0
DO UNTIL Counter > CPinfo.0
?? SAY 'CPinfo.'Counter ' = ' CPinfo.Counter
?? Counter = Counter + 1
END
//
PUSH '&ARGS'
'SCAN' fn ft fm
//
CPinfo. = ''
CP_Command = 'SPOOL CONSOLE STOP CLOSE TERM'
SAY CP_Command
'EXECIO * CP ( STEM CPinfo. STRING ' CP_Command ' )'
Counter = 0
DO UNTIL Counter > CPinfo.0
?? SAY 'CPinfo.'Counter ' = ' CPinfo.Counter
?? Counter = Counter + 1
END
PARSE VAR CPinfo.1 WITH . . SpoolID .
SAY 'Spool ID: ' SpoolID
IF SpoolID = '' THEN
?? DO
????? SAY 'Error: SpoolID ('SpoolID') not valid.'
????? RETURN 8
?? END
//
CPinfo. = ''
CP_Command = 'CHANGE RDR ' SpoolID ' CLASS A'
SAY CP_Command
'EXECIO * CP ( STEM CPinfo. STRING ' CP_Command ' )'
Counter = 0
DO UNTIL Counter > CPinfo.0
?? SAY 'CPinfo.'Counter ' = ' CPinfo.Counter
?? Counter = Counter + 1
END
//
CPinfo. = ''
CP_Command = 'ORDER RDR ' SpoolID
SAY CP_Command
'EXECIO * CP ( STEM CPinfo. STRING ' CP_Command ' )'
Counter = 0
DO UNTIL Counter > CPinfo.0
?? SAY 'CPinfo.'Counter ' = ' CPinfo.Counter
?? Counter = Counter + 1
END
//
'EXECIO * CARD ( STEM RDRLINE. )'
SAY RDRLINE.0 ' lines read.'
//
/* Exit cleanly.????????????????????????????????????????????????????? */
//
RETURN rc
Finally, does anyone know if the EXECIO source code is kept on CE V1R1M1, and where? If not, I can always go yank it off the 'net.
?... Mark S.