Expanding Data During Playback (MQ)


This scenario demonstrates expanding MQ message content during playback. The customer order and credit inquiry application provides 32 bytes for the customer name. Before modifying the application to accept a longer customer name, verify that the remote application can handle the additional bytes in the credit inquiry. To accomplish this, capture all of the activity from the entire customer order and credit inquiry application (Flowchart for the Sample Customer Order And Credit Inquiry Application). Generate 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. Create two copies of the script.

  • In the first copy, add REXX logic to write the “actual” PUT and GET message content to an external file during playback.
  • In the second copy, add REXX logic that uses the “actual” PUT messages from the external file to replace the customer name with the expanded customer name.

Credit Inquiry Activity Captured in Filtered Script FDDDD001

image2021-2-19_13-9-50.png

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:
    LOGDD001 — Log file used to play back script FDDDD001
    LOGED000 — Log file used to play back script FDDED000
  • Script:
    FDDDD001 — Script to capture “actual” GET and PUT message content
    FDDED000 — Script to play back with expanded customer names

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 how to modify the scripts and log files to achieve MQ message expansion.

Script edits

This section details the modifications made to each copy of the script.

  • FDDDD001, describes the REXX modifications necessary to write the “actual” GET and PUT message content to an external file.
  • FDDED000, describes the REXX modifications necessary to replace the customer name with the expanded customer name.

Important

Both sample scripts contain manually added comment boxes that explain each modification.

FDDDD001

At the beginning of the script:

  • Insert Performance Test REXX command HSCMDS to allocate the output file. 
  • Initialize a count variable.

The following figure shows this logic in bold text.

Sample Script FDDDD001 with Logic to Allocate an External File

************************************************************************
*
*  THIS SCRIPT HAS BEEN MODIFIED TO PERFORM DATA COLLECTION OF
*  MQ GET MESSAGE CONTENT.  AFTER THE CONTENT OF EACH MQ GET AND PUT,
*  A FUNCTION CALL HAS BEEN ADDED.  THIS FUNCTION, LOCATED AT THE END
*  OF THIS SCRIPT, WILL CREATE A FILE RECORD AND WRITE THE RECORD
*  TO AN EXTERNAL FILE.  THIS FILE MAY BE USED AS INPUT TO OTHER
*  MQ PLAYBACK RUNS, 3270 VALIDATION RUNS, OR USED TO DRIVE OTHER
*  APPLICATIONS.
*
*  THE FOLLOWING SCRIPT CODE ADDITIONS WILL:
*
*  1) ALLOCATE A FILE USING THE QAH REXX COMMAND HSCMDS
*  2) INITIALIZE THE REXX VARIABLE "I" WHICH IS USED TO CONTROL
*     THE DATA TO BE COLLECTED AND WRITTEN TO AN EXTERNAL FILE.
*     I IS THE INDEX FOR THE REXX STEM VARIABLE OUTREC
*
*
*  REVIEW THE DATASET NAME LOCATED IN THE ADDRESS COMMAND BELOW.
*  CHANGE COMPWARE.FDDDD001.REXX.OUTPUT TO AN APPROPRIATE
*  DATASET NAME.
*
************************************************************************
ADDRESS HSCMDS "ALLOC FILE (OUTDATA), 
DA(COMPWARE.FDDDD001.REXX.OUTPUT), OLD REUS" /*  <=== REVIEW  */ 
I = 0
*
*
* SCRIPT STARTED ON 2006/07/10 AT 12:12:01
* DESC: MULTIPLE GROUP
*

At the end of the script, insert two REXX procedures: one that collects GET data and one that collects PUT data.

  • Include the EXPOSE parameter on the PROCEDURE statement to make the REXX variables available to the REXX procedure and to script processing.
  • Increment the count variable. Use this value to supply an index on the REXX stem variable described in the next bullet.
  • Use the Performance Test REXX variable ACTUAL_MSG to return the content of the GETs/PUTs executed during playback. Concatenate the “actual” message content to a message type identifier and pass it to a REXX stem variable.
    Notice, "OUTREC." is followed by the count variable. Each time either of the procedures execute, the value of I increases by one. This ensures a unique stem index for each message, in addition to ensuring that the records are ordered chronologically. The content of the initial PUT is written to OUTREC.1 and the content of the resulting GETs is written to OUTREC.2, OUTREC.3, and OUTREC.4.
  • Terminate each procedure with a RETURN statement.

The following figure shows this logic in bold text.

Sample Script FDDDD001 with Data Collection Logic

*
*  THE FUNCTION BELOW WILL USE COLLECT DATA INTO THE STEM VARIABLE
*  OUTDATA.  AT THE END OF THE SCRIPT, THE STEM VARIABLE WILL BE
*  USED TO WRITE THE COLLECTED STEM DATA TO AN EXTERNAL FILE
*
*  THE REXX VARIABLE "I" IS USED TO CONTROL THE COLLECTION OF DATA
*  INTO THE STEM VARIABLE.
*  INREC
*
*  THE REXX STATEMENT "OUTREC.I = 'XXX ' || ACTUAL_MSG" WILL PLACE THE
*  TYPE OF MSG, GET OR PUT, FOLLOWED BY THE MESSAGE CONTENT.
*
*  THE FUNCTION USES THE EXPOSE OPTION ON THE PROCEDURE STATEMENT
*  TO MAKE REXX VARIABLES AVAILABLE TO THE FUNCTION AND THE MAINLINE
*  SCRIPT.
*
*  COLL_PUTS IS THE SAME AS COLL_GET WITH THE EXCEPTION OF THE TYPE
*  IDENTIFIER.
*
************************************************************************
COLL_GETS: PROCEDURE EXPOSE OUTREC. I ACTUAL_MSG
I = I + 1
OUTREC.I = 'GET ' || ACTUAL_MSG
RETURN 0
*
*
COLL_PUTS: PROCEDURE EXPOSE OUTREC. I ACTUAL_MSG
I = I + 1
OUTREC.I = 'PUT ' || ACTUAL_MSG
RETURN 0
******************************** Bottom of Data ********************************

Before the REXX data collection procedures, after the last MQ_DISCONNECT:

  • Insert an EXECIO statement that writes the OUTREC stem variable values to the dataset defined on the OUTDATA DD. Include the FINIS parameter to close file after all records have been written. 
  • Insert 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.

The following figure shows this logic in bold text.

Sample Script FDDDD001 with EXECIO and EXIT Statements

*
* MQ_DISCONNECT *
*
<TIME>2006/06/26_10:56:45.102880
<MQ_DISCONNECT,
  CONNECTION_ID = 21,
  COMPCODE = 0,
  REASON   = 0>85
*
*
************************************************************************
*
*  THE REXX STATEMENT BELOW WILL WRITE THE STEM OUTREC TO THE
*  OUTDATA DD.
*
************************************************************************
"EXECIO * DISKW OUTDATA (FINIS STEM OUTREC."
EXIT 0
************************************************************************
*
*  THE REXX EXECIO STATEMENT ABOVE WRITES THE STEM VARIABLE OUTREC
*  TO THE DATASET IDENTIFIED BY OUTDATA
*
*  THE REXX EXIT STATEMENT ABOVE MUST BE ADDED BEFORE THIS FUNCTION
*

Respectively insert one of the following function calls after the <CONTENT> of each MQ_GET and MQ_PUT:

X = COLL_GETS()
X = COLL_PUTS()

Play back the script to create the external file that the FDDDED000 script uses. In the log file or the control member specified on the log file’s SET ACTION statement, add the playback control parameters to enable interpretation of REXX and the use of the Performance Test REXX STREAM variables during playback. See Log Edits.

FDDED000

At the beginning of the script:

  • Insert Performance Test REXX command HSCMDS to allocate the input file. Specify the output dataset created during playback of the data collection script (FDDDD001). 
  • Insert an EXECIO statement to read the file into a REXX stem variable. In this case, INREC.n where n is the record number. Include the FINIS parameter to close file after all records have been read.
  • Initialize a count variable.

The following figure shows this logic in bold text.

Sample Script FDDED000 with Logic to Read in External Information

********************************* Top of Data **********************************
************************************************************************
*
*  THIS SCRIPT HAS BEEN MODIFIED TO PERFORM EXPANSION OF USER DATA FOR
*  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 EXPAND THE CUSTOMER NAME OF EACH MQ PUT
*  MESSAGE BEFORE USING THE QAH REPLACE COMMAND.  THE REPLACE ALTERS
*  THE CONTENTS OF THE NEXT ENCOUNTERED CONTENT TAG.
*
*  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) ALLOCATE A FILE USING THE QAH REXX COMMAND HSCMDS
*
*  2) READ IN THE FILE INTO A REXX STEM VARIABLE.  EACH RECORD
*     IS READ INTO THE STEM.X WHERE INREC IS THE STEM
*     AND X IS 1 - NUMBER OF RECORDS
*
*  3) CLOSE IS PERFORMED BY SPECIFYING THE FINIS PARM ON THE EXECIO
*
*  4) INITIALIZE THE REXX VARIABLE "I" WHICH IS USED TO CONTROL
*     THE DATA TO BE USED BY THE REPLACE STATEMENT.  I IS THE INDEX
*     FOR THE REXX STEM VARIABLE INREC
*
*  REVIEW THE DATASET NAME LOCATED IN THE ADDRESS COMMAND BELOW.
*  CHANGE COMPWARE.FDDDD001.REXX.OUTPUT TO THE DATASET NAME
*  CREATED IN SCRIPT FDDDD001 (LOGDD001).
*
************************************************************************
ADDRESS HSCMDS "ALLOC FILE (INDATA), 
DA(COMPWARE.FDDDD001.REXX.OUTPUT), SHR REUS" /*  <=== REVIEW  */ 
"EXECIO * DISKR INDATA (FINIS STEM INREC."
I = 0
*

At the end of the script, insert a REXX procedure to select the PUT messages from the external file, expand the length of the customer name value, and build the appropriate REPLACE verb. Data Replacement Logic at End of Sample Script FDDED000 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.
  • Increment the count variable. Use this to select the appropriate GET/PUT record as described in the next two bullets.
  • Use a substring instruction to pass the first three bytes the selected INREC to the TYPE variable. This returns the message type that was added to the beginning of the the “actual” GET/PUT content when the external file was written.
  • Insert a DO WHILE loop to select the PUT messages from the external file. If INREC.I is a GET, then increment the value of I to select the next record. Insert the TYPE variable declaration into the loop to return the message type of the next record. If INREC.I is a PUT, END the loop.
  • Each record in the external file contains the message type (GET/PUT) that was assigned during data collection, followed by a space, and then the 300 byte inquiry. The first byte of the inquiry is the attribute byte, the next 32 bytes are the customer name, and the rest of the bytes are reserved for additional customer information. Use the REXX substring instruction to parse the record. Pass the attribute byte, the customer name bytes, and the rest of the bytes to separate variables.
  • Concatenate ten spaces to the CUSTNAME variable and pass it to a new variable.
  • Use the Performance Test REPLACE verb, discussed on here, to execute the data replacement. Provide the offset to indicate where in the message to insert the data and provide the data to use for replacement. Use the LENGTH parameter to ensure that the total length of the inquiry is 310 bytes.
  • Complete the procedure with a REXX RETURN statement.

Data Replacement Logic at End of Sample Script FDDED000

*
*  THE FUNCTION USES THE EXPOSE OPTION ON THE PROCEDURE STATEMENT
*  TO MAKE REXX VARIABLES AVAILABLE TO THE FUNCTION AND THE MAINLINE
*  SCRIPT.
*
************************************************************************
*
*
CHNG_PUTS: PROCEDURE EXPOSE INREC. I FIRST EXPCUST REST
I = I + 1
TYPE     = SUBSTR(INREC.I,1,3)
DO WHILE TYPE = 'GET'
  I = I + 1
  TYPE     = SUBSTR(INREC.I,1,3)
END
FIRST    = SUBSTR(INREC.I,5,1)
CUSTNAME = SUBSTR(INREC.I,6,32)
REST     = SUBSTR(INREC.I,38,267)
*
EXPCUST  = CUSTNAME||'          '
*
<REPLACE  FIELD(0,FIRST) FIELD(1,EXPCUST) FIELD(43,REST) LENGTH=310>
RETURN 0

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.

Finally, insert a call to the CHG_PUTS() procedure before the <CONTENT> tag in each MQ_PUT. See the bold text in the following figure.

Procedure Call in Sample Script FDDED001

*
* 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 CHNG_PUTS
*  THE FUNCTION WILL EXPAND THE MQ MESSAGE DATA BEFORE USING THE
*  REPLACE STATEMENT TO MODIFY THE MQ MESSAGE.
*
*  THE FUNCTION CALL FOR CHNG_PUTS IS ADDED TO THE SCRIPT BEFORE EACH
*  CONTENT FOR ALL MQ_PUTS.
*
************************************************************************
X =  CHNG_PUTS()    /*  BEFORE EACH MQ PUT         */ *

  <CONTENT>.þ..000000010AMERICANFASTNERS

Log edits

Both scripts require the addition of the REXXON parameter to the playback control information to enable the interpretation of REXX during playback.

To use the ACTUAL_MSG variable in the data collection script (FDDDD001), add the SET_REXX_STREAM_VARIABLES(YES) parameter to the playback control information.

Either:

  • Add a CONTROL statement with one or both of these parameters directly to the log file used to run the playback job. Insert it above the MQGROUP statement.
  • Add the parameter to the CONTROL statement in 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*