Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
How can we count the number of records in a dataset?
Goto page Previous  1, 2
 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL
Author Message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 4355
Location: San Jose, CA

PostPosted: Wed Apr 20, 2005 12:53 am    Post subject:
Reply with quote

Can you recreate the TRLR record, that is, rebuild it on the fly with the information you need in it, or do you have to merge the new count into the existing trailer record? It looks like the trailer record only has three fields: 'TRLR' is a constant so it can be rebuilt on the fly. The count-2 can be rebuilt on the fly. So the question is can the 0150400002 field be rebuilt on the fly - is it always going to be 0150400002, or something else that can be built (e.g. the run date), or does it have to be saved from the trailer record and put back into it?

Quote:
Should I necessarily give the position of the Total recs count in TRLR rec, becos I have a number of similar files where the position of Total recs count may not be same in the above file it starts from 19 is 12 cols long.


Are you saying that the count may be in different places in the trailer record for different input files? If so, what is it you want to know about that?
Back to top
View user's profile Send private message
References
PostPosted: Wed Apr 20, 2005 12:53 am    Post subject: Re: Reply with quote

die7nadal

Active User


Joined: 23 Mar 2005
Posts: 154

PostPosted: Wed Apr 20, 2005 1:25 am    Post subject: Re: How can we count the number of records in a dataset?
Reply with quote

I cannot recreate the TRLR record, I just want to update the Record count in trailer Or it can be saved from the trailer rec and put back.
I wanted to know if I have to give the position of the count in the Control Card or if It can find by itself, bcos I have different File where the position of Recs count may vary Or in other words I wont know the position of the record Count.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 4355
Location: San Jose, CA

PostPosted: Wed Apr 20, 2005 3:09 am    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will give you what you want. You will have to change the job for different count locations, but I've used DFSORT Symbols to make that easier. Just map different records with the appropriate symbols.

You'll also need z/OS DFSORT V1R5 PTF UQ95214 or DFSORT R14 PTF UQ95213 (Dec, 2004) to use DFSORT's new COUNT-n and IFTHEN functions. If you have DFSORT, but you don't have the Dec, 2004 PTF, ask your System Programmer to install it.

Code:

//S1    EXEC  PGM=ICETOOL
//SYMNAMES DD *
*TRAILER RECORD SYMBOLS
* |RDW|'TRLR'|KEEP|count|
RDW,1,4        RDW
ID,*,4,CH      'TRLR' location
KEEP,*,14      Length of bytes between 'TRLR' and count
TRLID,'TRLR'   'TRLR' id
DELID,'TTTT'   'TTTT' id
/*
//TOOLMSG   DD  SYSOUT=*
//DFSMSG   DD  SYSOUT=*
//IN DD DSN=...  input file (VB)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT DD DSN=...  output file (VB)
//TOOLIN   DD    *
  COPY FROM(IN) USING(CTL1)
  COPY FROM(T1) TO(OUT) USING(CTL2)
/*
//CTL1CNTL DD *
* Change 'TRLR' in the original trailer record to 'TTTT'.
  INREC IFTHEN=(WHEN=(ID,EQ,C'TRLR'),OVERLAY=(5:DELID))
* Create a new trailer record with 'TRLR', the data from the
* original trailer record and a count of the data records
* (total input records - 2).
* T1 will have the header record, the data records, the
* 'TTTT' record and the new 'TRLR' record.
  OUTFIL FNAMES=T1,REMOVECC,
    TRAILER1=(TRLID,KEEP,COUNT-2=(M11,LENGTH=12))
/*
//CTL2CNTL DD *
* Remove the 'TTTT' record.
  OMIT COND=(ID,EQ,DELID)
/*
Back to top
View user's profile Send private message
die7nadal

Active User


Joined: 23 Mar 2005
Posts: 154

PostPosted: Wed Apr 20, 2005 7:00 am    Post subject: Re: How can we count the number of records in a dataset?
Reply with quote

Thanks Frank
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL All times are GMT + 6 HoursGoto page Previous  1, 2
Page 2 of 2