Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EXECIO Does Not Process Multiple Uses of STEM Correctly #80

Closed
marXtevens opened this issue May 18, 2022 · 2 comments
Closed

EXECIO Does Not Process Multiple Uses of STEM Correctly #80

marXtevens opened this issue May 18, 2022 · 2 comments

Comments

@marXtevens
Copy link
Collaborator

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.

@marXtevens
Copy link
Collaborator Author

EXECIO is on the MAINT 093 minidisk, as DMSXIO ASSEMBLE, and is part of VM/370 CE. The reason the problem occurs is that the right parenthesis used ')' for example in the following:

'EXECIO * CP ( STEM CPinfo. STRING ' CP_Command ' )'

Is consumed by the STRING parameter and passed to CP, causing an error. Therefor the solution is to NOT use the right parenthesis. Hence, the following code works as is needed.

/**********************************************************************/
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.'

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
'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.'

Counter = 0
DO UNTIL Counter > RDRLINE.0
   SAY 'RDRLINE.'Counter ' = ' RDRLINE.Counter
   Counter = Counter + 1
END

/**********************************************************************/
/* Exit cleanly.                                                      */
/**********************************************************************/
RETURN rc

@BobBolch
Copy link
Collaborator

')' character included in the string which was issued as a CP command caused the command failure. IBM deocuments that the trailing ')' should not be included when an EXECIO is issued with the STRING option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants