View previous topic :: View next topic |
Author |
Message |
rajith Beginner
Joined: 26 Dec 2005 Posts: 15 Topics: 9 Location: chennai
|
Posted: Fri May 26, 2006 2:22 pm Post subject: Getting the count of records in a KSDS file |
|
|
Guys,
Is there a way to get the count of records in a KSDS/ESDS file without actually reading the file in a CICS environment.
I did a search but couldnot get one.
Can anybody help??? _________________ Thanks,
Rajith |
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Fri May 26, 2006 3:10 pm Post subject: |
|
|
Rajith,
If u simply want to know how many records are there in your KSDS Dataset without actually reading ,run the JCL :
Code: | //SHEKARV JOB NOTIFY=&SYSUID,CLASS=A,
// MSGLEVEL=(1,1),MSGCLASS=X
//STEP0100 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
PRINT IDS('SHEKAR.TEST.KSDS') CHAR
/*
// |
OUTPUT IN THE SPOOL
Code: |
IDC0005I NUMBER OF RECORDS PROCESSED WAS xx
|
XX would be your number of records in the KSDS Dataset. _________________ Shekar
Grow Technically |
|
Back to top |
|
 |
rajith Beginner
Joined: 26 Dec 2005 Posts: 15 Topics: 9 Location: chennai
|
Posted: Fri May 26, 2006 3:48 pm Post subject: |
|
|
Shekar123,
I just want it in a CICS program and based on the count I would need to execute a transaction. Possible?? _________________ Thanks,
Rajith |
|
Back to top |
|
 |
shekar123 Advanced
Joined: 22 Jul 2005 Posts: 528 Topics: 90 Location: Bangalore India
|
Posted: Sat May 27, 2006 3:03 pm Post subject: |
|
|
Rajith,
I would suggest to read the records in a VSAM KSDS sequentially by the file's primary key and for every record read keep on increasing the counter by 1 till you reach the end of the file and you will be getting the total count of records and based on the count of records you can invoke a transaction.
A sample code :
Code: |
WORKING-STORAGE SECTION.
01 IN-REC-COUNT PIC S9(04) COMP VALUE 0.
PROCEDURE DIVISION.
PERFORM 100-START-BROWSE.
PERFROM 200-READ-RECORD UNTIL INPUT-EOF.
DISPLAY 'IN-REC-COUNT' IN-REC-COUNT.
IF IN-REC-COUNT > SOME CONDITION
EXEC CICS
START TRANSID(TRANIDNAME)
END-EXEC
END-IF.
STOP RUN.
100-START-BROWSE.
MOVE LOW-VALUES TO STARTBR-KEY.
EXEC CICS
STARTBR FILE('FILENAME')
RIDFLD(STARTBR-KEY)
RESP(RESPONSE-CODE)
END-EXEC.
200-READ-RECORD.
EXEC CICS
READNEXT FILE('FILENAME')
INTO(IN-REC)
RIDFLD(STARTBR-KEY)
END-EXEC.
ADD +1 TO IN-REC-COUNT.
|
_________________ Shekar
Grow Technically |
|
Back to top |
|
 |
|
|