say 'Hello from the TPNS simulation'
say 'The constants are:' handle_sa# data_sa# rc_counter#
file_data = 'HLQ.TPNS.DATA'
file_rc = 999
userexit('ITPFIOX', 'OPENI' rc_counter# handle_sa# data_sa#)
if file_rc <> 0 then say 'file error =' char(file_rc)
else say 'File' file_data 'opened. rc='char(file_rc)
do forever
userexit('ITPFIOX', 'READ' rc_counter# handle_sa# data_sa#)
if file_rc <> 0 then do
say 'file error =' char(file_rc)
leave
end
else
say 'Read from file:' substr(file_data,1,40)
end
if file_rc <> rc_eof then say 'Invalid operation' char(file_rc)
else say 'EOF reached, rc='char(file_rc)
userexit('ITPFIOX', 'CLOSE' rc_counter# handle_sa# )
if file_rc <> 0 then say 'file error =' char(file_rc)
else say 'File closed, rc='char(file_rc)
opcmnd ('ZEND')
say 'ZEND sended'
opcmnd ('P')
endtxt
end I run this simulation (after translation to MSG DECK) with next JCL
Code:
//MYIDTPNS JOB (5610),'TPNS',MSGCLASS=R,
// CLASS=Y,NOTIFY=&SYSUID,REGION=0M,PRTY=10
//*
// V NET,ID=MYTPNS,ACT
//*
// SET TPNSBASE='TPNS.LOAD'
// SET HLQ='MYUID.TPNS'
// SET MONID=MYMON
// SET NETID=MYTEST
// SET LOG='DSN=MYUID.TPNS.LOG(MYLOG),DISP=SHR'
// SET SYSP='DSN=MYUID.TPNS.LOG(PRINT),DISP=SHR'
//*SET LOG='SYSOUT=*'
//*
//* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//* T P N S S D S F S C R I P T -
//* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
//*
//ISPF EXEC PGM=ITPENTER,TIME=1440,PERFORM=20,DPRTY=(15,15),
// PARM='DMAPPL=&MONID,NTWRKL=&NETID'
//STEPLIB DD DSN=&TPNSBASE,DISP=SHR
//SYSPRINT DD &SYSP
//SYSABEND DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
//SYSUT2 DD SPACE=(CYL,(1,1,10)),UNIT=SYSDA
//SYSUT3 DD SPACE=(CYL,(1,1,10)),UNIT=SYSDA
//MSGDISK DD UNIT=SYSDA,SPACE=(4096,100)
//INITDD DD DSN=&HLQ..INIT,DISP=SHR
//MSGDD DD DSN=&HLQ..MSG,DISP=SHR
//LOGDD DD &LOG
The problems
1. The simulation performs all operations, file opens, reed operations finishes with code 0 and finally file is closed. But TPNS not finishes its work, JCL stacks on the step ISPF (see in JCL).
2. without using of opcmnd ('ZEND') MSG deck not finishes the simulation and without opcmnd ('P') TPNS takes an all output produced by the simulation and repeats it infinite times (this fills the SYS log and I receive compliment from the operators). I don't know if actually TPNS sends the same output or it rerun the same DECK again and again
(until I cancel job in SDSF).
The question: where is the problem , in my STL or some were else and how I can track this issue.
By the way, I'm not wrote this, but, if I remove from this STL all calls to userexit, the simulation finishes successful and TPNS also finishes without repeating of output and immediately. I think the problem is some how related to such userexit's.
Joined: 02 Jan 2012 Posts: 1 Location: New Zealand
I am guessing you have a NTWRK definition with PATH statements that
define TEST as the only msgtxt. If so then tpns will continue to attempt to
re-execute this deck. You must build in some scripting logic to stop execution.
In this case you have found that Zend and P will stop execution.
ZEND command causes an orderly shutdown of the tpns system and writes the message log buffers to the log data set and causes the job to end.
P command causes tpns to stop activity on the resource specified, in this case it will default to stopping the NTWRK, but because you have already ended tpns with Zend the P is not needed.
You may care to investigate the Quiesce command in STL. Also the Release command.