Replacing Script Data with a Static Value (MQ)


The scenario demonstrates adding REXX logic to the script to replace the customer name with a static value in every other credit inquiry. This test verifies that the remote application can successfully process a credit inquiry for a new customer.

This scenario begins by capturing activity from the entire customer order and credit inquiry application (Flowchart for the Sample Customer Order And Credit Inquiry Application), then generating a script that isolates the credit inquiry activity — that is, the MQ_PUTs that PDA018 issues to the remote inquiry queue and the MQ_GETs that it issues to the Credit Bureau Inquiry Response Queue. The following figure shows this activity.

Credit Inquiry Activity Captured in Filtered Script FDDSD000

image2021-2-19_12-53-9.png

The script then drives remote processing. The REXX logic added to the script replaces the customer name recorded in the script with a static value in every other inquiry.

During playback, generate an HTML Exception Report to verify data replacement. Every other inquiry should produce a mismatch.

This scenario requires adding REXX logic to the script and modifying the playback CONTROL statement in either the LOG file or the CONTROL member.

The rest of this section details each of these steps, except for capture. Use the filtering information provided in this discussion to generate scripts from sample repository REPOS1. To compare the scripts you generate to the sample scripts, run an analyze job on each script saving the sorted data. Generate a baseline HTML Exception Report to ensure that the script you created contains the same activity as the sample script.

Supporting sample files

The sample files supporting this scenario include:

  • Repository: REPOS1
  • Log: LOGSD000
  • Script: FDDSD000

Filters

REPOS1 contains activity for the entire customer order and credit inquiry program (Flowchart for the Sample Customer Order And Credit Inquiry Application). Apply the following filters during script creation to generate a script containing PDA018’s credit inquiry and response retrieval activity. See Credit Inquiry Activity Captured in Filtered Script FDDSD000 to view PDA018’s application flow and the names of the queues it uses.

Filter 1

Field Name

RO

Filtering Criteria

Queue manager

EQ

*

Object/Queue name

EQ

PDAPROD.QREMOTE.CW01.TO.CW09.CREDIT.AUTH

Event

EQ

PUT

Filter 2

Field Name

RO

Filtering Criteria

Queue manager

EQ

*

Object/Queue name

EQ

PDAPROD.QLOCAL.CW09.TO.CW01.CREDIT.AUTH

Event

EQ

GET


Important

Enter this filtering information on the Header Filter Detail screen (WebSphere MQ - Header Filter Detail screen) in the Create MQ Script facility. Also, be sure to select the Log Entries field on the WebSphere MQ Create Scripts - Create Options screen (2 of 2) to generate a LOG file to compare to the sample LOG file.

Script and log editing requirements

This section show you how to:

  • Modify the script to replace the customer name in every other inquiry with a static value.
  • Modify the log file to enable the use of REXX during playback.

Script edits

This section details the script modifications necessary to replace the recorded customer name with a static value in every other inquiry.

Important

The sample script, FDDSD000, contains comment boxes that were manually added to the script to explain each modification.

At the end of the script, insert a REXX procedure to replace the recorded customer name with the static value. Data Replacement Logic at End of Sample Script FDDSD000 shows the REXX logic added to the end of the script, along with the “flower box” that describes the logic.

  • Include the EXPOSE parameter on the PROCEDURE statement to make the REXX variables available to the REXX procedure and to script processing.
  • Use the REPLACE verb, discussed on here, to execute the data replacement. The REPLACE verb has two parameters:
    • offset indicates the starting position, relative to zero, for data replacement. The first byte of the customer name field is an attribute byte that must be preserved. Set the offset to 1 to begin replacing data at the second byte.
    • data is the replacement data. This example assigns the static value 'ABC CORPORATION' to the CUSTNAME variable. Whether you assign a variable or specify the value directly on the REPLACE verb, be sure the length of the replacement value matches the length of the data you need to replace. Notice the additional spaces between the end of ABC CORPORATION and the closing quotation mark — they ensure replacement of all 32 characters in the customer name field.
  • Include logic to select every other inquiry for data replacement. In this example, when CHG_CUST executes, the value of I is increased by 1. When I =2, the data is replaced and I is set to back zero.
  • Complete the procedure with a REXX RETURN statement.

Before the REXX procedure, add a REXX EXIT statement to terminate playback. Normally, playback terminates when all activity in the script has been executed. Since this example calls for adding REXX to the end of the script, the EXIT statement is necessary to indicate the end of the activity.

 Data Replacement Logic at End of Sample Script FDDSD000

EXIT 0
* ************************************************************************
*
*  THE REXX EXIT STATEMENT ABOVE MUST BE ADDED BEFORE THIS FUNCTION
*
*  THE FUNCTION BELOW WILL USE STATIC DATA REPLACEMENT TO ALTER THE
*  CONTENT.  THE QAH REPLACE COMMAND WILL PREPARE MESSAGE ALTERATIONS
*  TO BE USED BY THE NEXT CONTENT ENCOUNTERED
*
*  REXX VARIABLE "I" IS USED TO CONTROL DATA REPLACEMENT.  EVERY
*  OTHER MQ PUT WILL HAVE CONTENT DATA REPLACED.
*
*  THE QAH STATEMENT REPLACE(OFFSET,VARNAME) IS USED TO REPLACE DATA
*  LOCATED IN THE NEXT CONTENT ENCOUNTERED.  "OFFSET" IS RELATIVE
*  TO ZERO.
*
*  THE FUNCTION USES THE EXPOSE OPTION ON THE PROCEDURE STATEMENT
*  TO MAKE REXX VARIABLES AVAILABLE TO THE FUNCTION AND THE MAINLINE
*  SCRIPT.
*
************************************************************************
CHG_CUST: PROCEDURE EXPOSE CUSTNAME I
I = I + 1
IF I = 2 THEN DO
 CUSTNAME = 'ABC CORPORATION                 '
 I = 0
 <REPLACE  FIELD(1,CUSTNAME)>
END
RETURN 0

Next, add logic to set the initial value of I. Insert the variable initialization in the beginning of the script, before the MQ activity. See bold text in the following figure.

Variable Initialization in Sample Script FDDSD000 (Top)

************************************************************************
*
*  THIS SCRIPT HAS BEEN MODIFIED TO PERFORM STATIC DATA REPLACEMENT OF
*  MQ PUT MESSAGE CONTENT.  BEFORE THE CONTENT OF EACH MQ PUT,
*  A FUNCTION CALL HAS BEEN ADDED.  THIS FUNCTION, LOCATED AT THE END
*  OF THIS SCRIPT, WILL MODIFY THE CUSTOMER NAME OF EACH MQ PUT
*  MESSAGE USING THE QAH REPLACE COMMAND.  THE REPLACE ALTERS THE
*
*  REXX VARIABLE "I" IS USED TO CONTROL DATA REPLACEMENT.  EVERY
*  OTHER MQ PUT WILL HAVE CONTENT DATA REPLACED.
*
*  ADDITIONAL FLOWER BOXES ARE LOCATED IN THIS SCRIPT TO ASSIST IN
*  IDENTIFYING THE CHANGES MADE TO FACILITATE STATIC DATA REPLACEMENT
*  THE FOLLOWING SCRIPT CODE ADDITIONS WILL:
*
*  1) INITIALIZE THE REXX VARIABLE "I" WHICH IS USED TO CONTROL
*     WHEN DATA REPLACEMENT IS TO BE PERFORMED.  OTHER METHODS OF
*     CONTROL MAY BE USED TO CONTROL DATA REPLACEMENT
*
************************************************************************
I = 0
*
* SCRIPT STARTED ON 2006/07/10 AT 12:12:01
* DESC: MULTIPLE GROUP
*
<VERSION>07.01.00
<DETAIL COMBINED='*'>
*
*  MQ_CONNECT    *
*
* WARNING: MISSING DATA,SYNTHESIZED MQ_CONNECT TAG
<TIME>2006/06/26_10:55:57.885251
<MQ_CONNECT,
  CONNECTION_ID = 3,
  COMPCODE = 0,
  REASON = 0,
  QMGR_NAME = 'M520',

Then insert a call to the CHG_CUST procedure before the <CONTENT> tag in each MQ_PUT. See the bold text in the following figure.

Procedure Call in Sample Script FDDSD000

*
* MQ_PUT *
*
<TIME>2006/06/26_10:55:57.885251
<MQ_PUT,
  CONNECTION_ID = 3,
  OBJECT_ID = 16,
  COMPCODE = 0,
  REASON   = 0,
  MQMD_VERSION = 1,
  MQMD_REPORT = (NONE),
  MQMD_MSGTYPE = DATAGRAM,
  MQMD_EXPIRY = '00001388'X,
  MQMD_FEEDBACK = NONE,
  MQMD_ENCODING = '00000311'X,
  MQMD_CODEDCHARSETID = 0,
  MQMD_FORMAT = 'MQSTR',
  MQMD_PRIORITY = 'FFFFFFFF'X,
  MQMD_PERSISTENCE = NOT_PERSISTENT,
  MQMD_MSGID = 'C3E2D840D4F5F2F04040404040404040B99FE304AF5483C1'X,
  MQMD_CORRELID = NONE,
  MQMD_BACKOUTCOUNT = '',
  MQMD_REPLYTOQ = '',
  MQMD_REPLYTOQMGR = 'M520',
  MQMD_USERIDENTIFIER = 'MCONID',
  MQMD_ACCOUNTINGTOKEN = '1A11E4E2C3E6E7D5F0F14BC8F0F1C1C3F0F1F39FE307BA81E2000 
  MQMD_APPLIDENTITYDATA = '',
  MQMD_PUTAPPLTYPE = CICS,
  MQMD_PUTAPPLNAME = 'H01AC013PD18',
  MQMD_PUTDATE = '20060626',
  MQMD_PUTTIME = '14555797',
  MQMD_APPLORIGINDATA = '',
  MQPMO_VERSION = 1,
  MQPMO_OPTIONS = (FAIL_IF_QUIESCING,DEFAULT_CONTEXT,NO_SYNCPOINT),
  MQPMO_RESOLVEDQNAME = 'PDAPROD.QLOCAL.CW01.TO.CW09.CREDIT.AUTH',
  MQPMO_RESOLVEDQMGRNAME = 'O530',
  CRNTLEN = 300,
  TRUELEN = 300>3
************************************************************************
*
*  THE REXX STATEMENT BELOW WILL CALL THE FUNCTION CHG_CUST.
*  THE FUNCTION WILL PREPARE A REPLACE STATEMENT THAT ALTERS
*  THE CONTENT FOR THIS MQ_PUT.
*
*  THE FUNCTION CALL FOR CHG_CUST IS ADDED TO THE SCRIPT BEFORE EACH
*  CONTENT FOR ALL MQ_PUTS.
*
************************************************************************
X =  CHG_CUST()  /*  IN EACH MQ PUT BEFORE THE CONTENT */
*
  <CONTENT>.þ..000000010AMERICANFASTNERS

Log edits

To enable REXX interpretation during playback, add the REXXON parameter to the playback control information. Either:

  • Add a CONTROL statement with this parameter directly to the log file used to run the playback job. Insert it above the MQGROUP statement.
  • Add it to the control member specified on the log file’s SET ACTION statement.


 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*