)CMD * /*---------Language: OPS/MVS Rules----------------------------$$PROLOG*/ /* Program Name: REPLY */ /* Description: This rule will process replies to the outstanding*/ /* IMS WTOR, and lock the IMSCMD queue if it isn't */ /* already locked. This closes a window opened when*/ /* the operator replies to the ims wtor directly, or*/ /* when a program calls OPSCMD directly instead of */ /* using the IMSCMD traffic cop. */ /* Customization: None */ /* Statvars Used: GLOBAL0.IMSCMD.imsid.Q */ /* Related Routines: IMSCMD, DFS996I, DATETIME */ /* Base Release: CA-OPS/MVS 4.2, CA-Automation Point 3.2 */ /* Change log: Add new entries to the top */ /*-----------------Changed 03/17/1999 by: Bob Stark --------------1.0-*/ /* 1. Cleanup for distribution version 1.0 */ /*-----------------Changed 09/14/1998 by: Bob Stark ------------------*/ /* 1. Initial coding */ /*--------------------------------------------------------------------*/ /* Copyright (C) 1999 ProTech Professional Technical Services. No war-*/ /* ranty expressed or implied. Permission to use, copy, and distribute*/ /* this document without fee is hereby granted, provided that this */ /* copyright notice appear in all copies. Permission to modify the */ /* code is granted, but not the right to distribute the modified code,*/ /* which should be returned to the maintainer for inclusion into the */ /* distributed version. Contacts: 412-373-8855 www.protechpts.com */ /*--------------------------------------------------------------------*/ )PROC SELECT /* See if the command is a reply to a WTOR */ WHEN cmd.aofcmd = 1 THEN /* This command from OPS/MVS rule? */ RETURN /* Yes, ignore it. */ /*------------------------------------------------------------------*/ /* See if this is a fastpath reply (e.g. 99/dis a) by seeing if the */ /* command starts with a number. If so, extract all the numeric */ /* digits from the first word of the command, which should be the */ /* replyid. */ /*------------------------------------------------------------------*/ WHEN DATATYPE(LEFT(cmd.otext,1)) = 'NUM' THEN replyid = MAKVALID(OPSWORD(cmd.otext,1), '0123456789') WHEN cmd.verb = 'REPLY' THEN /* Is this a reply command? */ replyid = OPSWORD(cmd.otext,2) /* Yes, extract the replyid */ OTHERWISE RETURN /* Not a wtor reply, bail out */ END /*--------------------------------------------------------------------*/ /* At this point, we know that we have trapped the reply to a WTOR. */ /* Fetch the outstanding WTOR message for this reply to see if it is */ /* a reply to an IMS WTOR. If not, ignore the command. */ /*--------------------------------------------------------------------*/ CALL OPSCLEDQ CALL OPSTATUS 'R','L','*' DO i = 1 TO QUEUED() PULL data /*SAY data */ /* Removed due to it getting into actual IMS response*/ IF WORD(data,1) = replyid THEN DO IF WORD(data,3) <> 'DFS996I' THEN RETURN IMSID = WORD(data,WORDS(data)) LEAVE i END END i IF SYMBOL('IMSID') <> 'VAR' /* Was the reply to an IMS WTOR? */ THEN RETURN /* No, ignore this command. */ /*--------------------------------------------------------------------*/ /* At this point, we know that we have trapped the reply to an IMS */ /* WTOR. But we don't know if the reply was issued by IMSCMD (the */ /* IMS traffic cop) or some other program (or an operator). */ /* If the IMS command queue for the IMS region that the cmd was sent */ /* to is locked, then it's a good bet the command came thru IMSCMD. */ /* If not, it's a rogue command, so we'll lock the command queue so */ /* that any new caller's of IMSCMD get a red light until the IMS WTOR */ /* comes back. */ /*--------------------------------------------------------------------*/ glvname = 'GLOBAL0.IMSCMD.'imsid'.Q' /* IMS status variable name */ updated = 0 /* variable not updated (yet) */ DO i = 1 BY 1 UNTIL updated = 1 /* Spin until update succeeds */ current = OPSVALUE(glvname,'N') /* Get current value */ PARSE VAR current lock nextcmd IF lock = -replyid /* Is queue locked? */ THEN RETURN /* Yes, we're all done */ new = '-'replyid' 'nextcmd UPDATED = OPSVALUE(glvname,'C',new,current) END i RETURN /* All done processing this cmd. */ /*RXCOPY MAKVALID **** 28 LINES COPIED ON 03-17-99 AT 10:50************/ /*Start of MAKVALID Function----------------------------Version-01.00-*/ /*:MAKVALID Subroutine - removes any invalid characters from a string.*/ /* Example: */ /* valstr = MAKVALID(input,'1234567890*#') */ /* Parms: string, set of valid characters */ /* Returns: a potentially shorter string (maybe even null) */ /* Copyright (C) 1996 Washington Systems. All rights reserved. */ /*--------------------------------------------------------------------*/ MAKVALID: PROCEDURE EXPOSE gbl. TRACE N IF ARG() <> 2 THEN DO SAY 'ERROR - Must pass 2 arguments to MAKVALID' RETURN 'ERROR - Must pass 2 arguments to MAKVALID' END in = ARG(1) invalid = VERIFY(in,ARG(2),'NOMATCH',1) /* index of 1st inv character */ DO WHILE invalid <> 0 IF invalid = LENGTH(in) /* Very last character is bad? */ THEN RETURN LEFT(in,invalid-1) /* Yes, just trim it and go */ valid = VERIFY(in,ARG(2),'MATCH',invalid+1) IF valid = 0 /* Any more valid characters? */ THEN RETURN LEFT(in,invalid-1) /* No, just return the valid part */ in = LEFT(in,invalid-1)RIGHT(in,LENGTH(in)-valid+1) invalid = VERIFY(in,ARG(2),'NOMATCH',valid) END RETURN in /*End of MAKVALID function--------------------------------------------*/