HP XP Command View Advanced Edition Software User Manual

Page 246

Advertising
background image

SAY 'Executing KTSCAN STORGRP= 'scan_from;

CALL KTSCAN "STEM(DEMO_STEM.) MSG(DEMO_MSG.) ARRAYS(DEMO_SCAN.)",

" STORGRP("scan_from")";

END;

ELSE DO

SAY 'Ignore KTINDD LINE='recordStr

ITERATE;

END;

/*

* Check the return code to see if it is 0 or not.

*/

IF RESULT > 8 THEN

ScanFailed='Y';

ELSE IF RESULT < 8 THEN

ScannedVolumeIsFound='Y';

IF RESULT > 0 THEN

CALL printErrorMessage "KTSCAN" RESULT;

END;

IF ScanFailed='Y' THEN DO

SAY 'KTSCAN error occurred.';

EXIT 8;

END;

IF ScannedVolumeIsFound /='Y' THEN DO

SAY 'Scanned volume is nothing.';

EXIT 4;

END;

/*

* Store scanned volumes information to the DSK configuration dataset.

*

*/

CALL KTSTORE "STEM(DEMO_STEM.) MSG(DEMO_MSG.) ARRAYS(DEMO_SCAN.)",

" PREFIX("opt_prefix") DSK";

/*

* Check the return code to see if it is 0 or not.

*/

IF RESULT /= 0 THEN DO

CALL printErrorMessage "KTSTORE" RESULT;

EXIT 8;

END;

SAY "#-- END KTDEMO00." /* The sample script completed. */

EXIT 0;

/*

* printErrorMessage: This procedure prints all of the error messages

* in the Message structure when a CLI command failed.

*/

printErrorMessage: procedure expose DEMO_MSG.

ARG cli_name cli_result;

SAY "Command name=" || cli_name || ",result=" || cli_result;

IF DATATYPE(DEMO_MSG.0) = 'NUM' THEN

DO x = 1 to DEMO_MSG.0;

SAY "Severity = " || DEMO_MSG.x.Severity;

SAY "Text = " || DEMO_MSG.x.Text;

SAY "Value = " || DEMO_MSG.x.Value;

END;

RETURN 0;

Sample scripts

246

Advertising