MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Getting the count of records in a KSDS file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware
View previous topic :: View next topic  
Author Message
rajith
Beginner


Joined: 26 Dec 2005
Posts: 15
Topics: 9
Location: chennai

PostPosted: Fri May 26, 2006 2:22 pm    Post subject: Getting the count of records in a KSDS file Reply with quote

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
View user's profile Send private message Yahoo Messenger
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Fri May 26, 2006 3:10 pm    Post subject: Reply with quote

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
View user's profile Send private message
rajith
Beginner


Joined: 26 Dec 2005
Posts: 15
Topics: 9
Location: chennai

PostPosted: Fri May 26, 2006 3:48 pm    Post subject: Reply with quote

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
View user's profile Send private message Yahoo Messenger
shekar123
Advanced


Joined: 22 Jul 2005
Posts: 528
Topics: 90
Location: Bangalore India

PostPosted: Sat May 27, 2006 3:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> CICS and Middleware All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group