Skip to main content

Ever get on a D3 system and run WHERE LZ looking for stuff but get barraged by PIBs in some normal status? I got tired of that and wrote a BP that goes through WHERE LZ output and strips out the trivial stuff. Posting it here for anyone's use, but also to get opinions on improvements. Don't be shy!!

* whereLZ - bsc -09/05/2024
*
* ver 1.1 - bsc - 06/05/2025 - detect if hot backup secondary
*
tclread wCmd
slpTim = field(wCmd," ",2)'cn' ;* set sleep seconds
if slpTim else slpTim = 2      ;* default is 2
passes = field(wCmd," ",3)'cn' ;* set number of passes
if passes else passes = 3      ;* default is 3
isSecondary = 1 ;* call checkFHBRole(isSecondary)
for passNo = 1 to passes
  crt "Pass ":passNo
  execute \\where lz\\ capturing whereTxt
  aMax = dcount(whereTxt,@am)
  for aX = 4 to aMax
    line = whereTxt<aX>
    if index(line,"inconsis",1) then
      crt line ;* corrupt FCB/DCB/whateverCB
    end else
      wPib = line[2,4]
      if wPib matches "4n" then
        wMode = field(line[33,99],":",1)
        begin case
*           This first group is for both servers
          case wMode = "MD0"
          case wMode = "MD0_PINIT"
          case wMode = "MD0_PP"
          case wMode = "WRAPUPX_DISC_RSTART"
          case wMode = "RP_CMD"
          case wMode = "SP_SLEEP"
          case wMode = "PP_SCHED"
          case wMode = "WS_WHERE1"
          case wMode = "RQMSLEEP"
          case isSecondary ; crt line
*           This second group is primary only
          case wMode = "PX_RESUME"
          case wMode = "PX_INPUT"
          case wMode = "AU_INPUT"
          case wMode = "PX_IN"
          case wMode = "RDL_GETCHAR"
          case wMode = "SP_SPOOLOUT"
          case wMode = "SP_SERIALSLEEP"
          case wMode = "SLEEP50"
          case wMode = "SLEEPSUBX"
          case wMode = "GETITM"
          case wMode = "CNTRLNP"
          case 1 ; crt line
        end case
      end
    end
  next aX
  sleep slpTim
next passNo



------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------

Ever get on a D3 system and run WHERE LZ looking for stuff but get barraged by PIBs in some normal status? I got tired of that and wrote a BP that goes through WHERE LZ output and strips out the trivial stuff. Posting it here for anyone's use, but also to get opinions on improvements. Don't be shy!!

* whereLZ - bsc -09/05/2024
*
* ver 1.1 - bsc - 06/05/2025 - detect if hot backup secondary
*
tclread wCmd
slpTim = field(wCmd," ",2)'cn' ;* set sleep seconds
if slpTim else slpTim = 2      ;* default is 2
passes = field(wCmd," ",3)'cn' ;* set number of passes
if passes else passes = 3      ;* default is 3
isSecondary = 1 ;* call checkFHBRole(isSecondary)
for passNo = 1 to passes
  crt "Pass ":passNo
  execute \\where lz\\ capturing whereTxt
  aMax = dcount(whereTxt,@am)
  for aX = 4 to aMax
    line = whereTxt<aX>
    if index(line,"inconsis",1) then
      crt line ;* corrupt FCB/DCB/whateverCB
    end else
      wPib = line[2,4]
      if wPib matches "4n" then
        wMode = field(line[33,99],":",1)
        begin case
*           This first group is for both servers
          case wMode = "MD0"
          case wMode = "MD0_PINIT"
          case wMode = "MD0_PP"
          case wMode = "WRAPUPX_DISC_RSTART"
          case wMode = "RP_CMD"
          case wMode = "SP_SLEEP"
          case wMode = "PP_SCHED"
          case wMode = "WS_WHERE1"
          case wMode = "RQMSLEEP"
          case isSecondary ; crt line
*           This second group is primary only
          case wMode = "PX_RESUME"
          case wMode = "PX_INPUT"
          case wMode = "AU_INPUT"
          case wMode = "PX_IN"
          case wMode = "RDL_GETCHAR"
          case wMode = "SP_SPOOLOUT"
          case wMode = "SP_SERIALSLEEP"
          case wMode = "SLEEP50"
          case wMode = "SLEEPSUBX"
          case wMode = "GETITM"
          case wMode = "CNTRLNP"
          case 1 ; crt line
        end case
      end
    end
  next aX
  sleep slpTim
next passNo



------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------

..

next aX
if system(14) then inputclear; crt "WhereLZ stopped by user"; stop
sleep slpTim



------------------------------
Stefano Maran
Senior programmer
GTN SpA
Tavagnacco IT
------------------------------

Ever get on a D3 system and run WHERE LZ looking for stuff but get barraged by PIBs in some normal status? I got tired of that and wrote a BP that goes through WHERE LZ output and strips out the trivial stuff. Posting it here for anyone's use, but also to get opinions on improvements. Don't be shy!!

* whereLZ - bsc -09/05/2024
*
* ver 1.1 - bsc - 06/05/2025 - detect if hot backup secondary
*
tclread wCmd
slpTim = field(wCmd," ",2)'cn' ;* set sleep seconds
if slpTim else slpTim = 2      ;* default is 2
passes = field(wCmd," ",3)'cn' ;* set number of passes
if passes else passes = 3      ;* default is 3
isSecondary = 1 ;* call checkFHBRole(isSecondary)
for passNo = 1 to passes
  crt "Pass ":passNo
  execute \\where lz\\ capturing whereTxt
  aMax = dcount(whereTxt,@am)
  for aX = 4 to aMax
    line = whereTxt<aX>
    if index(line,"inconsis",1) then
      crt line ;* corrupt FCB/DCB/whateverCB
    end else
      wPib = line[2,4]
      if wPib matches "4n" then
        wMode = field(line[33,99],":",1)
        begin case
*           This first group is for both servers
          case wMode = "MD0"
          case wMode = "MD0_PINIT"
          case wMode = "MD0_PP"
          case wMode = "WRAPUPX_DISC_RSTART"
          case wMode = "RP_CMD"
          case wMode = "SP_SLEEP"
          case wMode = "PP_SCHED"
          case wMode = "WS_WHERE1"
          case wMode = "RQMSLEEP"
          case isSecondary ; crt line
*           This second group is primary only
          case wMode = "PX_RESUME"
          case wMode = "PX_INPUT"
          case wMode = "AU_INPUT"
          case wMode = "PX_IN"
          case wMode = "RDL_GETCHAR"
          case wMode = "SP_SPOOLOUT"
          case wMode = "SP_SERIALSLEEP"
          case wMode = "SLEEP50"
          case wMode = "SLEEPSUBX"
          case wMode = "GETITM"
          case wMode = "CNTRLNP"
          case 1 ; crt line
        end case
      end
    end
  next aX
  sleep slpTim
next passNo



------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------

* whereLZ - bsc - 09/05/2024
*
* ver 1.1 - bsc - 06/05/2025 - detect if hot backup secondary
*     1.2 - sm  - 2025-06-05 - stop by keypress
*     1.3 - sm  - 2025-06-06 - allow to show more than then first line
*
tclread wCmd
*
slpTim = field(wCmd," ",2)'cn' ;* set sleep seconds
if slpTim >= 0 else slpTim = 2 ;* default is 2
*
passes = field(wCmd," ",3)'cn' ;* set number of passes
if passes > 0 else passes = 3  ;* default is 3
*
isSecondary = 1 ;* call checkFHBRole(isSecondary)
*
*
show_first_line_only=0 ;* +[sm_1.3]  0=no, all lines   1=yes, only the first line
*
*
for passNo = 1 to passes
  *
  crt "Pass ":passNo:" - ":oconv(time(),'mts')
  *
  execute \\where lzhn\\ capturing whereTxt
  aMax = dcount(whereTxt,@am)
  *
  *
  show=0 ;* +[sm_1.3]
  *
  *
  for aX = 4 to aMax
    *
    line = whereTxt<aX>
    if index(line,"inconsis",1) then
                                              show=1 ;* crt line ;* corrupt FCB/DCB/whateverCB
    end else
      *
      wPib = line[2,4]
      if wPib matches "4n" then
        *
        wMode = field(line[33,99],":",1)
        begin case
*           This first group is for both servers
          case wMode = "MD0";                 show=0
          case wMode = "MD0_PINIT";           show=0
          case wMode = "MD0_PP";              show=0
          case wMode = "WRAPUPX_DISC_RSTART"; show=0
          case wMode = "RP_CMD";              show=0
          case wMode = "SP_SLEEP";            show=0
          case wMode = "PP_SCHED";            show=0
          case wMode = "WS_WHERE1";           show=0
          case wMode = "RQMSLEEP";            show=0
          case isSecondary ;                  show=1 ;* crt line
*           This second group is primary only
          case wMode = "PX_RESUME";           show=0
          case wMode = "PX_INPUT";            show=0
          case wMode = "AU_INPUT";            show=0
          case wMode = "PX_IN";               show=0
          case wMode = "RDL_GETCHAR";         show=0
          case wMode = "SP_SPOOLOUT";         show=0
          case wMode = "SP_SERIALSLEEP";      show=0
          case wMode = "SLEEP50";             show=0
          case wMode = "SLEEPSUBX";           show=0
          case wMode = "GETITM";              show=0
          case wMode = "CNTRLNP";             show=0
          case 1 ;                            show=1 ;* crt line
        end case
        *
      end else
        *
        if show_first_line_only then show=0 ;* +[sm_1.3]
        *
      end
      *
    end
    *
    if show then crt line
    *
  next aX
  *
  if system(14) then inputclear; crt "WhereLZ stopped by user"; stop ;* +[sm_1.2]
  sleep slpTim
  *
next passNo



------------------------------
Stefano Maran
Senior programmer
GTN SpA
Tavagnacco IT
------------------------------

* whereLZ - bsc - 09/05/2024
*
* ver 1.1 - bsc - 06/05/2025 - detect if hot backup secondary
*     1.2 - sm  - 2025-06-05 - stop by keypress
*     1.3 - sm  - 2025-06-06 - allow to show more than then first line
*
tclread wCmd
*
slpTim = field(wCmd," ",2)'cn' ;* set sleep seconds
if slpTim >= 0 else slpTim = 2 ;* default is 2
*
passes = field(wCmd," ",3)'cn' ;* set number of passes
if passes > 0 else passes = 3  ;* default is 3
*
isSecondary = 1 ;* call checkFHBRole(isSecondary)
*
*
show_first_line_only=0 ;* +[sm_1.3]  0=no, all lines   1=yes, only the first line
*
*
for passNo = 1 to passes
  *
  crt "Pass ":passNo:" - ":oconv(time(),'mts')
  *
  execute \\where lzhn\\ capturing whereTxt
  aMax = dcount(whereTxt,@am)
  *
  *
  show=0 ;* +[sm_1.3]
  *
  *
  for aX = 4 to aMax
    *
    line = whereTxt<aX>
    if index(line,"inconsis",1) then
                                              show=1 ;* crt line ;* corrupt FCB/DCB/whateverCB
    end else
      *
      wPib = line[2,4]
      if wPib matches "4n" then
        *
        wMode = field(line[33,99],":",1)
        begin case
*           This first group is for both servers
          case wMode = "MD0";                 show=0
          case wMode = "MD0_PINIT";           show=0
          case wMode = "MD0_PP";              show=0
          case wMode = "WRAPUPX_DISC_RSTART"; show=0
          case wMode = "RP_CMD";              show=0
          case wMode = "SP_SLEEP";            show=0
          case wMode = "PP_SCHED";            show=0
          case wMode = "WS_WHERE1";           show=0
          case wMode = "RQMSLEEP";            show=0
          case isSecondary ;                  show=1 ;* crt line
*           This second group is primary only
          case wMode = "PX_RESUME";           show=0
          case wMode = "PX_INPUT";            show=0
          case wMode = "AU_INPUT";            show=0
          case wMode = "PX_IN";               show=0
          case wMode = "RDL_GETCHAR";         show=0
          case wMode = "SP_SPOOLOUT";         show=0
          case wMode = "SP_SERIALSLEEP";      show=0
          case wMode = "SLEEP50";             show=0
          case wMode = "SLEEPSUBX";           show=0
          case wMode = "GETITM";              show=0
          case wMode = "CNTRLNP";             show=0
          case 1 ;                            show=1 ;* crt line
        end case
        *
      end else
        *
        if show_first_line_only then show=0 ;* +[sm_1.3]
        *
      end
      *
    end
    *
    if show then crt line
    *
  next aX
  *
  if system(14) then inputclear; crt "WhereLZ stopped by user"; stop ;* +[sm_1.2]
  sleep slpTim
  *
next passNo



------------------------------
Stefano Maran
Senior programmer
GTN SpA
Tavagnacco IT
------------------------------

Nice, Stephano. I like it!!



------------------------------
Brian S. Cram
Principal Technical Support Engineer
Rocket Software
------------------------------