/* Rexx */
/*-------------------------------------------------------------------*/
/* Description: */
/* */
/* This REXX contains a sample that lists all records in the CKDS. */
/* */
/* NOTE: Useful for small datasets. */
/* */
/* NOTE: For large datasets, use IDCAMS REPRO */
/* //PRINTKDS EXEC PGM=IDCAMS,REGION=4M */
/* //SYSPRINT DD SYSOUT=* */
/* //INDD DD DSN=CSF.CKDS,DISP=SHR */
/* //OUTDD DD DSN=CSF.CKDS.FLAT,DISP=OLD */
/* //SYSIN DD * */
/* REPRO OUTFILE(OUTDD) INFILE(INDD) */
/* */
/* How To Run: */
/* - Execute this script from TSO */
/* (e.g. EX 'HLQ.MLD.LLQ(LISTCKDS)') */
/*-------------------------------------------------------------------*/
/*********************************************************************/
/* Get the CKDS record count */
/*********************************************************************/
kdsl_rule_count = '00000003'x
kdsl_rule_array = 'CKDS ' ||,
'COUNT ' ||,
'ALL '
kdsl_label_filter_len = '00000000'x
kdsl_label_filter = ''
kdsl_srch_length = '00000000'x
kdsl_srch_criteria = ''
kdsl_output_list_length = '00000000'x
kdsl_output_list = ''
kdsl_continuation_area = copies('00'x,100)
Call CSFKDSL;
ckds_label_count = C2D(kdsl_label_count)
SAY "CKDS record count: " ckds_label_count
/*********************************************************************/
/* List the CKDS record labels */
/*********************************************************************/
output_size = 72 * ckds_label_count /* 72-byte CKDS labels */
kdsl_rule_count = '00000003'x
kdsl_rule_array = 'CKDS ' ||,
'LABELS ' ||,
'ALL '
kdsl_label_filter_len = '00000001'x
kdsl_label_filter = '*' /* All labels */
kdsl_srch_length = '00000000'x
kdsl_srch_criteria = '' /* No specific criteria*/
kdsl_output_list_length = D2C(output_size)
kdsl_output_list = copies('00'x,output_size)
kdsl_continuation_area = copies('00'x,100)
CALL CSFKDSL
SAY "-----------------------------------------------------------------"
SAY "End of Sample"
SAY "-----------------------------------------------------------------"
EXIT
/* --------------------------------------------------------------- */
/* CSFKDSL - Key Data Set List */
/* */
/* Generates a list or count of CKDS and PKDS labels or TKDS */
/* object handles. */
/* */
/* See the ICSF Application Programmer's Guide for more details. */
/* --------------------------------------------------------------- */
CSFKDSL:
kdsl_rc = 'FFFFFFFF'x
kdsl_rs = 'FFFFFFFF'x
kdsl_exit_length = '00000000'x
kdsl_exit_data = ''
kdsl_label_count = '00000000'x
kdsl_reserved1_length = '00000000'x
kdsl_reserved1 = ''
kdsl_reserved2_length = '00000000'x
kdsl_reserved2 = ''
ADDRESS LINKPGM "CSFKDSL",
"kdsl_rc" "kdsl_rs" ,
"kdsl_exit_length" "kdsl_exit_data" ,
"kdsl_rule_count" "kdsl_rule_array" ,
"kdsl_label_filter_len" "kdsl_label_filter" ,
"kdsl_srch_length" "kdsl_srch_criteria" ,
"kdsl_label_count" ,
"kdsl_output_list_length" "kdsl_output_list" ,
"kdsl_reserved1_length" "kdsl_reserved1" ,
"kdsl_reserved2_length" "kdsl_reserved2" ,
"kdsl_continuation_area"
IF (kdsl_rc /= '00000000'x) THEN
DO
SAY 'KDSL Failed (rc=' C2X(kdsl_rc)' rs='C2X(kdsl_rs)')'
EXIT
END
IF (kdsl_output_list_length /= '00000000'x) THEN
DO
offset = 1
DO i = 1 TO C2D(kdsl_label_count)
SAY 'Key Label: ',
SUBSTR(kdsl_output_list,offset,64) /* Ignore 8 byte key type */
offset = offset + 72
END
END
RETURN