/**REXX **************************************************************/ /* */ /*01* EXEC-NAME: HZSSXCHN */ /* */ /* */ /*01* DESCRIPTIVE-NAME: Sample REXX check for the IBM Health Checker */ /* for z/OS. */ /* */ /*01* PROPRIETARY STATEMENT= */ /* **PROPRIETARY_STATEMENT********************************************/ /* */ /* */ /* LICENSED MATERIALS - PROPERTY OF IBM */ /* 5694-A01 COPYRIGHT IBM CORP. 2010 */ /* */ /* STATUS= HBB7770 */ /* */ /* **END_OF_PROPRIETARY_STATEMENT*************************************/ /* */ /* */ /*01* FUNCTION: */ /* */ /* This demonstrates how to send check messages without a message */ /* table using HZSLFMSG_REQUEST="DIRECTMSG". */ /* See sample HZSSXCHK for how to send messages with a message */ /* table using HZSLFMSG_REQUEST="CHECKMSG". */ /* */ /* This module contains two check routines, differentiated by */ /* entry code. */ /* Entry code 1: HZS_SAMPLE_REXXIN_CHECK_DM */ /* - Requires a REXXIN data set that may be empty: */ /* IBMUSER.HZSSXCHN.REXXIN.E1 */ /* - Issues HZS1002E */ /* - Produces a report consisting of a "header" and multiple */ /* entries */ /* - Produces an exception message */ /* Entry code 2: HZS_SAMPLE_REXXTSO_CHECK_DM */ /* - Requires a fully-qualified input data set, without quotes, */ /* specified by the check PARMS value. */ /* */ /* PARMS('DSN(IBMUSER.HZSSXCHN.DATA)') */ /* */ /* - Allocates and frees the data specified in the check PARMS */ /* - Produces a success message */ /* - When an unexpected condition occurs the data set is freed. */ /* */ /*02* OPERATION: SUBROUTINES */ /* */ /* */ /*02* RECOVERY-OPERATION: */ /* */ /* When the result of call to HZSLSTRT, HZSLFMSG, or */ /* HZSLSTOP is 8 or greater the request has failed and */ /* additional variables are provided by the function to */ /* diagnose the problem. */ /* */ /* Recovery is provided by System REXX for exec execution. */ /* */ /*********************************************************************/ /* */ /*01* NOTES: */ /* */ /* - A statement may be added to an HZSPRMxx member of PARMLIB */ /* to define the check, including the name of a System REXX */ /* exec. Similar keywords are also available using the */ /* HZSADDCK macro, which may be issued from a check */ /* registration exit routine, like HZSSADCK. */ /* */ /* */ /* - When REXXIN(YES) is specified in the check definition, */ /* a sequential data set is a required input to the System */ /* REXX exec. The name of the data set is determined by the */ /* specified high level qualifier (REXXHLQ), exec name (EXEC), */ /* and optional entrycode. */ /* */ /* rexxhlq.execname.REXXIN.Eentrycode */ /* */ /* When entrycode is zero or unspecified, REXXIN is: */ /* rexxhlq.execname.REXXIN */ /* */ /* */ /* The following example requires a sequential data set named */ /* IBMUSER.HZSSXCHN.REXXIN.E1 */ /* */ /* ADDREP CHECK(IBMSAMPLE,HZS_SAMPLE_REXXIN_CHECK_DM) */ /* EXEC(HZSSXCHN) */ /* REXXHLQ(IBMUSER) */ /* REXXTSO(NO) */ /* REXXIN(YES) */ /* MSGTBL(*NONE) */ /* ENTRYCODE(1) */ /* USS(NO) */ /* VERBOSE(NO) */ /* PARMS('LIMIT(047)') */ /* SEVERITY(LOW) */ /* INTERVAL(ONETIME) */ /* DATE(20100719) */ /* REASON('A sample check to demonstrate an ', */ /* 'exec check using REXXIN and DIRECTMSG.') */ /* */ /* REXXTSO(YES) is the default when REXXTSO is not */ /* specified. REXXIN(YES) is not supported when TSO services */ /* are available to allocate data sets. In this example the */ /* data set name is provided in the check PARMS. */ /* */ /* ADDREP CHECK(IBMSAMPLE,HZS_SAMPLE_REXXTSO_CHECK_DM) */ /* EXEC(HZSSXCHN) */ /* REXXHLQ(IBMUSER) */ /* REXXTSO(YES) */ /* REXXIN(NO) */ /* MSGTBL(*NONE) */ /* ENTRYCODE(2) */ /* USS(NO) */ /* VERBOSE(NO) */ /* PARMS('DSN(IBMUSER.HZSSXCHN.DATA)') */ /* SEVERITY(LOW) */ /* INTERVAL(0:05) */ /* EINTERVAL(SYSTEM) */ /* DATE(20100719) */ /* REASON('A sample check to demonstrate an ', */ /* 'exec check using TSO services and DIRECTMSG.') */ /* */ /* - No message table is required: Note the use of MSGTBL(*NONE) */ /* on the ADDREP statement. */ /* */ /* - To request that REXX messages be directed to the REXXOUT */ /* data set, use the modify command to update the DEBUG */ /* attribute. */ /* */ /* F hzsproc,UPDATE,CHECK=(checkowner,checkname),DEBUG=ON */ /* */ /* Note: When a check is disabled due to a parameter error */ /* new PARMS must be specified on the UPDATE command. */ /* */ /* The name of the REXXOUT data set is determined by the */ /* high level qualifier (REXXHLQ), exec name (EXEC), and */ /* optional entrycode. */ /* */ /* rexxhlq.execname.REXXOUT.Eentrycode */ /* */ /* When entrycode is zero or unspecified, REXXOUT is: */ /* rexxhlq.execname.REXXOUT */ /* */ /*02* DEPENDENCIES: */ /* */ /* System REXX and Health Checker must be active. */ /* */ /*02* RESTRICTIONS: */ /* */ /* The exec must be placed in a System REXX exec */ /* data set and defined to IBM Health Checker for z/OS. */ /* */ /* */ /*01* MODULE-TYPE: EXEC */ /* */ /*02* PROCESSOR: SYSTEM REXX */ /* */ /*02* ATTRIBUTES: */ /* */ /*03* LOCATION: A System REXX exec data set, for example */ /*03* SYS1.SAXREXEC */ /*03* EXEC NAME: HZSSXCHN */ /*03* TYPE: Executable source */ /* */ /*********************************************************************/ /* */ /*02* PURPOSE: See FUNCTION section for this module. */ /* */ /*03* OPERATION: See OPERATION section for this module. */ /* */ /*02* ATTRIBUTES: */ /* */ /*03* ENTRY */ /* */ /*04* STATE: Authorized */ /*04* DISPATCH MODE: Task */ /*04* ADDRESS SPACE: A System REXX address space */ /* */ /*03* EXECUTION */ /* */ /*04* STATE: Authorized */ /*04* ADDRESS SPACE: A System REXX address space */ /* */ /* */ /*03* CALLERS: */ /* */ /* IBM Health Checker for z/OS initiates check execution */ /* by calling System REXX which calls the check. */ /* */ /*02* INPUT: */ /* */ /*03* DATA SET: */ /* */ /* When REXXIN(YES) indicates a data set is required input */ /* to the exec (See Notes). */ /* */ /*03* VARIABLES: */ /* */ /* HZS_Handle - a hex variable the check should not touch. */ /* It is implicit input to check functions. */ /* */ /* HZS_PQE_Entry_Code - the entry code specified when the */ /* check was added. */ /* */ /* HZS_PQE_Function_Code is one of the following: */ /* */ /* INITRUN - The first time a check is called */ /* when it it added or after it has */ /* been disabled. */ /* */ /* RUN - Subsequent calls have a function */ /* code of RUN */ /* */ /* HZS_PQE_CHKWORK is a 2k work area that is initialized to */ /* nulls. Its contents is saved when HZSLSTOP */ /* is called. The saved value is available the */ /* next time the check is called and calls */ /* HZSLSTRT. */ /* */ /*02* OUTPUT: */ /* */ /* 1) Messages issued via HZSLFMSG to the message buffer */ /* 2) Check status in the IBM Health Checker for z/OS display. */ /* 3) Messages issued by System REXX may be directed to */ /* REXXOUT, which is created when the check is placed in */ /* DEBUG mode. */ /* 4) HZS_PQE_CHKWORK */ /* */ /*02* EXIT-NORMAL: RETURN TO CALLER */ /* */ /*03* CONDITIONS: When the exec completes */ /* */ /*03* RETURN-CODES: None */ /* */ /*02* EXIT-ERROR: None */ /* */ /*********************************************************************/ /* */ /*01* EXTERNAL-REFERENCES : */ /* */ /*02* ROUTINES: */ /* */ /* None */ /* */ /*02* DATA-AREAS: */ /* */ /* See Callable Functions and Input. */ /* */ /* */ /*01* CALLABLE-FUNCTIONS: */ /* */ /* HZSLSTRT - The check routine must first invoke HZSLSTRT */ /* to notify IBM Health Checker for z/OS it is */ /* running. This call initializes the following */ /* variable which are defined in the HZSPQE */ /* macro. For a complete list of all the */ /* variables provided by HZSLSTRT see: */ /* */ /* SA22-7994-xx IBM Health Checker for z/OS User's Guide */ /* */ /* HZS_PQE_LOOKATPARMS */ /* HZS_PQE_DEBUG */ /* HZS_PQE_PARMAREA */ /* HZS_PQE_CHKWORK */ /* */ /* HZSLFMSG - IBM Health Checker for z/OS Message function */ /* */ /* HZSLSTOP - Inform IBM Health Checker for z/OS of check */ /* completion. This request will save the user */ /* workarea, HZS_PQE_ChkWork. */ /* */ /*01* SERIALIZATION: */ /* */ /* None */ /* */ /*01* MESSAGES: */ /* */ /* The following health check messages can be sent via the */ /* HZSLFMSG_REQUEST = "DIRECTMSG" invocations below: */ /* */ /* HZSH0011E */ /* HZSH0030I */ /* */ /* The following message are used to report problems with the */ /* the check. They are described in the HZSFMSG macro. */ /* Additional information is available in: */ /* */ /* SA22-7994-00 IBM Health Checker for z/OS: User's Guide */ /* */ /* HZS1001E */ /* HZS1002E */ /* HZS1209E */ /* HZS1213E */ /* HZS1214E */ /* HZS1215E */ /* */ /*01* ABEND-CODES: None */ /* */ /*01* WAIT-STATE-CODES: */ /* */ /* None */ /* */ /*01* CHANGE-ACTIVITY: */ /* */ /* $L0=HCHECK ,HBB7740,061220,PDZJ: Sample Sysrexx exec check */ /* $P1=ME10838 ,HBB7750,070623,PDZJ: CHECK rc for zero */ /* $P1=OW22520 ,HBB7750,071017,PDMP: APAR rollup (Not zero) */ /* $L1=OAxxxxx ,HBB7770,100719,RDUT: DIRECTMSG support */ /* */ /**** END OF SPECIFICATIONS ******************************************/ /*********************************************************************/ /* If HZSLSTRT is not successful all IBM Health Checker for z/OS */ /* function calls will fail. */ /*********************************************************************/ HZSLSTRT_RC = HZSLSTRT() IF HZSLSTRT_RC <> 0 THEN /* @P2C*/ DO IF HZS_PQE_DEBUG = 1 THEN DO /* Report debug detail in REXXOUT */ SAY "HZSLSTRT RC" HZSLSTRT_RC SAY "HZSLSTRT RSN" HZSLSTRT_RSN SAY "HZSLSTRT SYSTEMDIAG" HZSLSTRT_SYSTEMDIAG END EXIT /* Exit, check cannot be performed */ END /*********************************************************************/ /* Check the entry code to determine which check to process */ /*********************************************************************/ IF HZS_PQE_ENTRY_CODE = 1 THEN DO Call Process_HZS_SAMPLE_REXXIN_CHECK END IF HZS_PQE_ENTRY_CODE = 2 THEN DO Call Process_HZS_SAMPLE_REXXTSO_CHECK END EXIT /*********************************************************************/ /* Process HZS_SAMPLE_REXXIN_CHECK */ /*********************************************************************/ Process_HZS_SAMPLE_REXXIN_CHECK: /*********************************************************************/ /* Read the data in REXXIN that System Rexx has allocated */ /*********************************************************************/ "EXECIO * DISKR "AXRINDD" (STEM RexxIn. FINIS" /*********************************************************************/ /* Check the function code to determine what to do */ /*********************************************************************/ /* Look for Init function */ /*********************************************************************/ IF HZS_PQE_FUNCTION_CODE = "INITRUN" THEN DO Say "HZS_PQE_CHKWORK is null" /*********************************************************************/ /* Put code here for Init processing for HZS_SAMPLE_REXXIN_CHECK */ /*********************************************************************/ /*********************************************************************/ /* End of Init Function */ /*********************************************************************/ END /*********************************************************************/ /* Look for RUN function */ /*********************************************************************/ IF HZS_PQE_FUNCTION_CODE = "RUN" THEN DO Say "HZS_PQE_CHKWORK is "HZS_PQE_CHKWORK /*********************************************************************/ /* Put code here for RUN processing for HZS_SAMPLE_REXXIN_CHECK */ /*********************************************************************/ /* End of RUN Function */ /*********************************************************************/ END /*********************************************************************/ /* Process parameters for HZS_SAMPLE_REXXIN_CHECK */ /*********************************************************************/ /* */ /* Put code here to process the parameters in HZS_PQE_ParmArea. */ /* Quotes that were specified in the PARMS value are not included */ /* in HZS_PQE_PARMAREA or its length. */ /* */ /* For our example, */ /* - assume that the required parameter string is LIMIT(nnn) where */ /* */ /* nnn is a 3-digit decimal number. */ /* - If the syntax is not correct, call HZSLFMSG with a STOP */ /* request for a reason of BADPARM */ /* o HZS1001E is issued for the error. */ /* o The check is disabled with a status of BADPARM */ /* o The check is not called again until the PARMS are updated */ /* with a new value. */ /* - Parse message HZS1209E, HZS1213E, HZS1214E, and HZS1215E are */ /* issue to the console and placed in the message buffer. */ /* - The modify command is used to UPDATE check PARMS */ /* */ /* F hzsproc,UPDATE,CHECK=(chkname,chkowner),PARMS=('value') */ /* */ /*********************************************************************/ If HZS_PQE_LOOKATPARMS = 1 THEN DO Parse UPPER Var HZS_PQE_PARMAREA, "LIMIT("Limit_Value")"EndLimitVar+1 Select /*********************************************************************/ /* Issue: HZS1209E, PARAMETER parm IS NOT RECOGNIZED. */ /*********************************************************************/ When EndLimitVar <> ")" THEN DO /* LIMIT() was not found */ Limit_value = "" /* limit value is not correct */ HZSLFMSG_REQUEST = "HZSMSG" HZSLFMSG_REASON = "PARS1209" HZSLFMSG_insert.0 = 1 /* one insert is required */ If Length(HZS_PQE_PARMAREA) > 17 THEN HZSLFMSG_insert.1 = Substr(HZS_PQE_PARMAREA,1,17) /* Only 17 bytes may be included in the message */ ELSE HZSLFMSG_insert.1 = HZS_PQE_PARMAREA HZSLFMSG_RC = HZSLFMSG() /*********************************************************************/ /* */ /* When the message service detects a user error, HZSLFMSG result */ /* will be 8. */ /* */ /* HZSLSFMSG_RSN = 000008xx A user error was detected */ /* */ /* HZSLSFMSG_RSN = 0000089F See HZSLFMSG_USERRSN. */ /* HZSLSFMSG_USERRSN The reason for the user error. */ /* See ABEND REASON CODES in HZSFMSG */ /* */ /* HZSLFMSG_ABENDRESULT contains diagnostic detail about user */ /* errors */ /* */ /*********************************************************************/ IF HZS_PQE_DEBUG = 1 THEN DO /* place debug detail in REXXOUT */ SAY "PARMS: ||"HZS_PQE_PARMAREA"||" SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG SAY "USER RSN" HZSLFMSG_UserRsn SAY "USER RESULT" HZSLFMSG_AbendResult END END When Datatype(Limit_Value) <> "NUM" THEN /*********************************************************************/ /* Issue: HZS1215E, PARAMETER parm VALUE value IS NOT DECIMAL */ /*********************************************************************/ DO /* the value is not decimal */ HZSLFMSG_REQUEST = "HZSMSG" HZSLFMSG_REASON = "PARS1215" HZSLFMSG_insert.0 = 2 /* two inserts are required */ If Length(HZS_PQE_PARMAREA) > 16 THEN HZSLFMSG_insert.1 = Substr(HZS_PQE_PARMAREA,1,16) /* Only 16 bytes may be included in insert one of this message */ ELSE HZSLFMSG_insert.1 = HZS_PQE_PARMAREA If Length(Limit_value) > 17 THEN HZSLFMSG_insert.2 = Substr(Limit_value,1,17) /* Only 17 bytes may be included in insert two of this message */ ELSE HZSLFMSG_insert.2 = Limit_value Limit_value = "" /* limit value is not correct */ HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO /* place debug detail in REXXOUT */ SAY "PARMS: ||"HZS_PQE_PARMAREA"||" SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG SAY "USER RSN" HZSLFMSG_UserRsn SAY "USER RESULT" HZSLFMSG_AbendResult END Limit_value = "" END When Length(HZS_PQE_PARMAREA) > 10 |, Length(Limit_Value) > 3 THEN /*********************************************************************/ /* Issue: HZS1213E, PARAMETER parm VALUE IS TOO LONG. */ /*********************************************************************/ DO /* Parms are too long */ HZSLFMSG_REQUEST = "HZSMSG" HZSLFMSG_REASON = "PARS1213" HZSLFMSG_insert.0 = 2 /* two inserts are required */ If Length(HZS_PQE_PARMAREA) > 16 THEN HZSLFMSG_insert.1 = Substr(HZS_PQE_PARMAREA,1,16) /* Only 16 bytes may be included in insert one of this message */ ELSE HZSLFMSG_insert.1 = HZS_PQE_PARMAREA IF Length(Limit_Value) <= 3 THEN Limit_Value = HZS_PQE_PARMAREA /* limit value did not cause this error, report the entire parm */ If Length(Limit_value) > 17 THEN HZSLFMSG_insert.2 = Substr(Limit_value,1,17) /* Only 17 bytes may be included in insert two of this message */ ELSE HZSLFMSG_insert.2 = Limit_value Limit_value = "" /* limit value is not correct */ HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO /* place debug detail in REXXOUT */ SAY "PARMS: ||"HZS_PQE_PARMAREA"||" SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG SAY "USER RSN" HZSLFMSG_UserRsn SAY "USER RESULT" HZSLFMSG_AbendResult END END When Length(HZS_PQE_PARMAREA) < 10 |, Length(Limit_Value) < 3 THEN /*********************************************************************/ /* Issue: HZS1213E, PARAMETER parm VALUE IS TOO SHORT. */ /*********************************************************************/ DO /* Parms are too short */ HZSLFMSG_REQUEST = "HZSMSG" HZSLFMSG_REASON = "PARS1214" HZSLFMSG_insert.0 = 2 /* two inserts are required */ If Length(HZS_PQE_PARMAREA) > 16 THEN HZSLFMSG_insert.1 = Substr(HZS_PQE_PARMAREA,1,16) /* Only 16 bytes may be included in insert one of this message */ ELSE HZSLFMSG_insert.1 = HZS_PQE_PARMAREA IF Length(Limit_Value) >= 3 THEN Limit_Value = HZS_PQE_PARMAREA /* limit value did not cause this error, report the entire parm */ If Length(Limit_value) > 17 THEN HZSLFMSG_insert.2 = Substr(Limit_value,1,17) /* Only 17 bytes may be included in insert two of this message */ ELSE HZSLFMSG_insert.2 = Limit_value Limit_value = "" /* limit value is not correct */ HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO /* place debug detail in REXXOUT */ SAY "PARMS: ||"HZS_PQE_PARMAREA"||" SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG SAY "USER RSN" HZSLFMSG_UserRsn SAY "USER RESULT" HZSLFMSG_AbendResult END END Otherwise HZS_PQE_CHKWORK = Limit_Value /* Save the parm in the check workarea */ END If Limit_Value = "" THEN DO HZSLFMSG_REQUEST = "STOP" HZSLFMSG_REASON = "BADPARM" HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO /* Report debug detail in REXXOUT */ SAY "PARMS: ||"HZS_PQE_PARMAREA"||" SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "USER RESULT" HZSLFMSG_ABENDRESULT SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG END END /*********************************************************************/ /* End of Parm Changed */ /*********************************************************************/ END /*********************************************************************/ /* ..... */ /*********************************************************************/ /* When an unexpected event occurs HZSLFMSG may be invoked with */ /* a STOP request to disable the check for an ERROR reason. This */ /* - The check status is changed to UNEXPECTED ERROR */ /* - If a request is made to run the check again it will receive */ /* control with a function_code of INITRUN and HZS_PQE_CHKWORK */ /* will be nulls. */ /* - Message HZS1002E is issued: */ /* */ /* HZS1002E CHECK(IBMSAMPLE,HZS_SAMPLE_REXXIN_CHECK_DM): */ /* AN ERROR OCCURRED, DIAG: xxxxxxxx_xxxxxxxx */ /* */ /* HZSLFMSG_DIAG */ /* HZS1002E includes a diagnostic value that is provided by the */ /* caller. This value must be sixteen characters containing the */ /* values 0-F, or an eight hex bytes. Hex values like HZS_HANDLE */ /* contain non-displayable characters. Initializing HZSLFMSG_DIAG */ /* to the following values produce the same results. */ /* */ /* A 16 character text string */ /* using only characters 0-F: 00000001FFFFFFFD */ /* or an 8 byte hex value: 00000001FFFFFFFDx */ /* */ /* DIAG: 00000001_FFFFFFFD */ /* */ /* An 8 byte value that was not hex: FFFFFFFD */ /* would be displayed in ebcdic */ /* */ /* DIAG: C6C6C6C6_C6C6C6C4 */ /* */ /* When HZSLFMSG_DIAG cannot be processed the message is still */ /* issued, but the DIAG output contains HZSLFMSG_RSN instead */ /* of the input value. */ /* */ /* DIAG: ABD29000_022F0891 */ /* */ /* The example below calls a routine that cannot be found which */ /* result in a -3 being return to the request. A negative decimal */ /* value would cause the request to fail. The negative value */ /* must be expressed in hex or as a whole number. */ /* */ /* ErrorWord1 - 1 In this example the value 1 is used */ /* Char8Rc - x a -3 indicate REXX cannot find a routine */ /* A negative value cannot be used, the value */ /* is converted to 8 characters that are the */ /* hex equivalent of -3. */ /* */ /* Both fields are initialized to 8 character values and */ /* used as input to the request. */ /* */ /* HZS1002E CHECK(IBMSAMPLE,HZS_SAMPLE_REXXIN_CHECK_DM): */ /* AN ERROR OCCURRED, DIAG: 00000001_FFFFFFFD */ /* */ /* Note: */ /* To use a whole number to represent the error the */ /* minus sign must first be removed. */ /* */ /* This example removes the minus sign. */ /* */ /* Char8Rc = Strip(RC,"L","-") */ /* */ /* The value must be eight characters, zeroes are */ /* used to right align the decimal number. */ /* */ /* Char8Rc = Right(Char8Rc,8,0) */ /* */ /* DIAG: 00000001_00000003 */ /* */ /*********************************************************************/ IF Words(Limit_value) = 1 THEN /* parameters were successfully processed */ DO /* demonstrate disabling the check for an unexpected error */ ADDRESS LINK "HZSXXXXX" /* Call a module that cannot be found */ Char8Rc = d2x(RC,8) /* convert RC (-3) to the 8 character hex equivalent value FFFFFFFD */ ErrorWord1 = Right(1,8,0) /* create exactly 8 characters with a value of 00000001 */ HZSLFMSG_REQUEST = "STOP" HZSLFMSG_REASON = "ERROR" HZSLFMSG_DIAG = ErrorWord1||Char8Rc /* the value 1 is concatenated to the RC */ HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO /* Report debug detail in REXXOUT */ SAY "LIMIT_VALUE" DataType(Limit_Value) Limit_Value SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG END END /*********************************************************************/ /* Put the body of Check processing for HZS_SAMPLE_REXXIN_CHECK here */ /*********************************************************************/ /* .... */ /*********************************************************************/ /* */ /* Write the report header */ /* */ /* REQUEST DIRECTMSG indicates the message will be provided */ /* right here, instead of via a referencce to a message table. */ /* */ /* When an error occurs issuing a DIRECTMSG request, additional */ /* diagnostic information is returned for a user error. */ /* */ /* When the message service detects a user error, HZSLFMSG result */ /* will be 8. */ /* */ /* HZSLSFMSG_RSN = 000008xx A user error was detected */ /* */ /* HZSLSFMSG_RSN = 0000089F See HZSLFMSG_USERRSN. */ /* HZSLSFMSG_USERRSN The reason for the user error. */ /* See ABEND REASON CODES in HZSFMSG */ /* */ /* HZSLFMSG_AbendResult contains diagnostic detail about user */ /* errors */ /*********************************************************************/ HZSLFMSG_REQUEST = "DIRECTMSG" /* A no-message-table request */ HZSLFMSG_REASON = "CHECKINFO" /* ...for an informational line */ /* as report title line */ HZSLFMSG_DIRECTMSG_ID = "HZSH0021I" /* with a message ID */ HZSLFMSG_DIRECTMSG_TEXT = "Widget statistics" /* and the actual */ /* header line text */ HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG IF HZSLFMSG_RC = 8 THEN /* A user error occurred */ DO SAY "USER RSN" HZSLFMSG_UserRsn SAY "USER RESULT" HZSLFMSG_AbendResult END END HZSLFMSG_REQUEST = "DIRECTMSG" /* A no-message-table request */ HZSLFMSG_REASON = "CHECKREPORT" /* ...for report column headers */ HZSLFMSG_DIRECTMSG_TEXT = "Widgets Avail InUse" /* headers text */ HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG IF HZSLFMSG_RC = 8 THEN /* A user error occurred */ DO SAY "USER RSN" HZSLFMSG_UserRsn SAY "USER RESULT" HZSLFMSG_AbendResult END END /*********************************************************************/ /* Write report data line 1 with its 3 columns. */ /* */ /*********************************************************************/ HZSLFMSG_REQUEST = "DIRECTMSG" /* A no-message-table request */ HZSLFMSG_REASON = "CHECKREPORT" /* ...for a report line */ HZSLFMSG_DIRECTMSG_TEXT = "Normal 0000000A 00000020" /* line text */ HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG IF HZSLFMSG_RC = 8 THEN /* A user error occurred */ DO SAY "USER RSN" HZSLFMSG_UserRsn SAY "USER RESULT" HZSLFMSG_AbendResult END END /*********************************************************************/ /* Place code here to determine whether to write exception message */ /* or an "all is OK" message. */ /* */ /*********************************************************************/ /* */ /* The exec can use AXRCMD to issue system command analyze the */ /* command results. See System REXX in z/OS MVS Programming: */ /* Authorized Assembler Services Guide for information about the */ /* AXRCMD function. */ /* */ /*********************************************************************/ /* Assuming the code above detected an exception situation, */ /* Build and write exception message */ /* */ /*********************************************************************/ /* Request a "direct", no-message-table message */ HZSLFMSG_REQUEST = "DIRECTMSG" /* As a check exception */ HZSLFMSG_REASON = "CHECKEXCEPTION" /* Message id */ HZSLFMSG_DIRECTMSG_ID = "HZSH0011E" /* Message summary text */ HZSLFMSG_DIRECTMSG_TEXT = "There are 0000000A (decimal 10) remaining", "available special widgets. This is below the limit." /* (Optional) message explanation */ HZSLFMSG_DIRECTMSG.EXPL = "The current number of available widgets", "is less than the parameter-specified limit of 20 (decimal 32)" /* (Optional) system action */ HZSLFMSG_DIRECTMSG.SYSACT = "The system continues processing." /* (Optional) operator response */ HZSLFMSG_DIRECTMSG.ORESP = , "Report this error to the System Programmer." /* (Optional) system programmer response */ HZSLFMSG_DIRECTMSG.SPRESP = "Make more widgets available" /* (Optional) problem determination */ HZSLFMSG_DIRECTMSG.PROBD = "For problem determination, ...." /* (Optional) source */ HZSLFMSG_DIRECTMSG.SOURCE = "The owning product" /* (Optional) reference documentation */ HZSLFMSG_DIRECTMSG.REFDOC = "Look at the following manuals", "to explain the error message further or help diagnose", "and correct the problem reported...." /* (Optional) automation */ HZSLFMSG_DIRECTMSG.AUTOMATION = "n/a" HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG IF HZSLFMSG_RC = 8 THEN DO SAY "USER RSN" HZSLFMSG_UserRsn SAY "USER RESULT" HZSLFMSG_AbendResult END END /*********************************************************************/ /* End of Check Function */ /*********************************************************************/ HZSLSTOP_RC = HZSLSTOP() /* report check completion */ IF HZS_PQE_DEBUG = 1 THEN DO /* Report debug detail in REXXOUT */ SAY "HZSLSTOP RC" HZSLSTOP_RC SAY "HZSLSTOP RSN" HZSLSTOP_RSN SAY "HZSLSTOP SYSTEMDIAG" HZSLSTOP_SYSTEMDIAG END Return /*********************************************************************/ /* Process HZS_SAMPLE_REXXTSO_CHECK */ /*********************************************************************/ Process_HZS_SAMPLE_REXXTSO_CHECK: /*********************************************************************/ /* Process parameters for HZS_SAMPLE_REXXTSO_CHECK */ /*********************************************************************/ /* */ /* When an unexpected condition occurs control is passed to the */ /* appropriate routine specified by the labels SYNTAX, ERROR, */ /* FAILURE, NOVALUE, and HALT. */ /* */ /*********************************************************************/ SIGNAL ON SYNTAX SIGNAL ON ERROR SIGNAL ON FAILURE SIGNAL ON NOVALUE SIGNAL ON HALT /*********************************************************************/ /* */ /* For our example, */ /* - assume that the required parameter string is DSN(value) where */ /* */ /* value is the fully-qualified input data set, without quotes, */ /* specified by the check PARMS value. */ /* */ /* */ /* PARMS('DSN(IBMUSER.HZSSXCHN.DATA)') */ /* */ /* TSO allocation will locate the data set in the system catalog */ /* and reserve exclusive access to the data set. */ /* */ /*********************************************************************/ Parse Upper var HZS_PQE_PARMAREA PARMSL "DSN("DataSetName")" PARMSR DataSetName = Strip(DataSetName,"B","'") /* Remove any quotes */ IF PARMSL <> "" |, PARMSR <> "" |, DatasetName = "" THEN /* A syntax error exists */ DO; /******************************************************************/ /* */ /* - If a syntax error is detected the in the check PARMS a */ /* message is issued to the console, indicating a parameter */ /* error has occurred. The check will not run again until */ /* the check PARMS are given a new value. */ /* */ /* */ /* SY1 HZS1203E CHECK(IBMSAMPLE,HZS_SAMPLE_REXXTSO_CHECK_DM): */ /* */ /* PARAMETER DSN(DataSetName) VALUE 'value' IS NOT VALID */ /* */ /******************************************************************/ HZSLFMSG_REQUEST = "HZSMSG" HZSLFMSG_REASON = "PARS1203" HZSLFMSG_insert.0 = 2 /* two inserts are required */ SELECT WHEN (PARMSL <> "") THEN HZSLFMSG_insert.2 = Strip(Substr(HZS_PQE_PARMAREA,1,16)) /* Only 16 bytes may be included in insert one of this message */ WHEN (PARMSR <> "") THEN HZSLFMSG_insert.2 = Strip(Substr(PARMSR,1,16)) WHEN (DataSetName = "") THEN HZSLFMSG_insert.2 = Substr(HZS_PQE_PARMAREA,1,16) OTHERWISE ; END HZSLFMSG_insert.1 = 'DSN(DataSetName)' HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO /* Report debug detail in REXXOUT */ SAY "PARMS: ||"HZS_PQE_PARMAREA"||" SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG END /******************************************************************/ /* */ /* - DISABLE the check with a stop request and exit */ /* */ /******************************************************************/ HZSLFMSG_REQUEST = "STOP" HZSLFMSG_REASON = "BADPARM" HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO /* Report debug detail in REXXOUT */ SAY "PARMS: ||"HZS_PQE_PARMAREA"||" SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG END EXIT /* The check is not performed */ END ELSE DO; /******************************************************************/ /* */ /* - Use TSO allocation to locate the data set in the system */ /* */ /* SIGNAL ON ERROR note: */ /* */ /* - a bad return code from allocation will cause the ERROR */ /* routine to be invoked. */ /* */ /******************************************************************/ DataSetName = "'"||Strip(DataSetName,"B","'")||"'" /* Include quotes for allocation */ ADDRESS TSO "Alloc DSN("DataSetName") OLD" ADDRESS TSO "FREE DSN("DataSetName")" /* free the data set */ END /*********************************************************************/ /* Place code here to determine whether to write exception message */ /* or an "all is OK" message. */ /* */ /* The exec can use AXRCMD to issue system command analyze the */ /* command results. See System REXX in z/OS MVS Programming: */ /* Authorized Assembler Services Guide for information about the */ /* AXRCMD function. */ /* */ /*********************************************************************/ /* Assuming the code above did not detect an exception situation, */ /* Write "all is OK" message */ /*********************************************************************/ HZSLFMSG_REQUEST = "DIRECTMSG" /* A no-message-table request */ HZSLFMSG_REASON = "CHECKINFO" /* As informational/success message */ HZSLFMSG_DIRECTMSG_ID = "HZSH0030I" /* Message ID */ HZSLFMSG_DIRECTMSG_TEXT = "Current usage of widgets is OK." /* text */ HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG IF HZSLFMSG_RC = 8 THEN /* A user error occurred */ DO SAY "USER RSN" HZSLFMSG_UserRsn SAY "USER RESULT" HZSLFMSG_AbendResult END END /*********************************************************************/ /* End of Check Function */ /*********************************************************************/ HZSLSTOP_RC = HZSLSTOP() /* report check completion */ IF HZS_PQE_DEBUG = 1 THEN DO /* Report debug detail in REXXOUT */ SAY "HZSLSTOP RC" HZSLSTOP_RC SAY "HZSLSTOP RSN" HZSLSTOP_RSN SAY "HZSLSTOP SYSTEMDIAG" HZSLSTOP_SYSTEMDIAG END Return /*********************************************************************/ /* */ /* HZS_SAMPLE_REXXTSO_CHECK unexpected conditions: */ /* SYNTAX, ERROR, FAILURE, NOVALUE and HALT are specified by the */ /* SIGNAL function and receive control when an unexpected event */ /* occurs. */ /* */ /* - Report the line in error */ /* - Free the input data set if it is allocated */ /* - DISABLE the check and exit */ /* */ /*********************************************************************/ SYNTAX: ERROR: FAILURE: NOVALUE: HALT: ERR1 = "An Error has occurred on line: "Sigl ERR2 = sourceline(sigl) Say Err1 Say "Line "Sigl" text: "Err2 ADDRESS TSO "FREE DSN("DataSetName")" HZSLFMSG_REQUEST = "STOP" /* Disable the check */ HZSLFMSG_REASON = "ERROR" HZSLFMSG_DIAG = Right(RC,16,0) /* report the decimal rc in the HZS1002E message and the check display detail */ HZSLFMSG_RC = HZSLFMSG() IF HZS_PQE_DEBUG = 1 THEN DO /* Report debug detail in REXXOUT */ SAY "PARMS: "HZS_PQE_PARMAREA SAY "HZSLFMSG RC" HZSLFMSG_RC SAY "HZSLFMSG RSN" HZSLFMSG_RSN SAY "SYSTEMDIAG" HZSLFMSG_SYSTEMDIAG END EXIT /* The check is not performed */