| View previous topic :: View next topic |
| Author |
Message |
sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Fri Oct 26, 2007 12:14 am Post subject: Count the number of lines in PDS |
|
|
Hi
Is it possible to know the total number of lines for each member in PDS. Eg: 500 members in one PDS, to find how may lines in each 500 members i.e total number of lines .It's possible to find out the lines.
Thanks & regards,
Siva |
|
| Back to top |
|
 |
vivek1983 Intermediate

Joined: 20 Apr 2006 Posts: 222 Topics: 24
|
Posted: Fri Oct 26, 2007 1:19 am Post subject: |
|
|
sivafdms,
You can concatenate alll the members in the PDS using the following fileaid job and count the number of records in the concatenated file using sort. Try this untested code.
| Code: |
//STEP100 EXEC PGM=FILEAID
//SYSPRINT DD SYSOUT=*
//SYSLIST DD SYSOUT=*
//DD01 DD DSN=YOUR PDS,
// DISP=SHR
//DD01O DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(50,50),RLSE)
//SYSIN DD
$$DD01 COPY
/*
//STEPO1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&T1,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL REMOVECC,NODETAIL,
TRAILER1=('TOTAL COUNT: ',COUNT)
/*
|
_________________ Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay) |
|
| Back to top |
|
 |
sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Fri Oct 26, 2007 8:19 am Post subject: |
|
|
it's giving error that
"SYSIN IS ALREADY ALLOCATED" |
|
| Back to top |
|
 |
vivek1983 Intermediate

Joined: 20 Apr 2006 Posts: 222 Topics: 24
|
Posted: Fri Oct 26, 2007 8:26 am Post subject: |
|
|
sivafdms,
Replace the sysin with the below one in step100. I missed a '*'.
| Code: |
//SYSIN DD *
$$DD01 COPY
/*
|
_________________ Vivek G
--------------------------------------
A dream is just a dream. A goal is a dream with a plan and a deadline. (Harvey Mackay) |
|
| Back to top |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Mon Oct 29, 2007 12:44 am Post subject: Re: Count the number of lines in PDS |
|
|
siva,
First download all your PDS members onto a flat file and then using SORT you can get the total number of lines.
The below IEBPTPCH job copies your PDS members toa flat file.
| Code: | //STEP0100 EXEC PGM=IEBPTPCH
//SYSUT1 DD DSN=YOUR PDS,
// DISP=SHR
//SYSUT2 DD DSN=&T,DISP=(,PASS),SPACE=(CYL,(10,10),RLSE)
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
PUNCH TYPORG=PO
//*
//STEP0200 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=&T,DISP=(OLD,PASS)
//SORTOUT DD DSN=DOWNLOAD FLAT FILE,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// SPACE=(CYL,(10,10),RLSE)
//SYSIN DD *
OPTION COPY
OUTREC FIELDS=(2,80) $ TO REMOVE ANSI CHARACTER
/* |
The following DFSORT/ICETOOL job to get a message with the record count.
| Code: | //COUNT EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=DOWNLOAD FLAT FILE,
// DISP=SHR
//TOOLIN DD *
COUNT FROM(IN)
/* |
|
|
| Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Mon Oct 29, 2007 1:29 am Post subject: |
|
|
Please, people. Not every solution to a mainframe question involves a SORT product. Why would you copy data to a new location (and risk running out of space, authorization problems, etc) when you can write a few lines of Rexx or even CLIST and just read each member and keep a count? Surely the desire to avoid writing a tiny utility program can't be that strong. (And please don't say "but I don't know Rexx" or "Rexx isn't allowed in my shop". A mainframe professional not knowing some basic Rexx is like a chef not knowing what a spice is, and not allowing Rexx is like a restaurant not allowing food.) _________________ New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html. |
|
| Back to top |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
Posted: Mon Oct 29, 2007 1:41 am Post subject: |
|
|
| semigeezer wrote: | | A mainframe professional not knowing some basic Rexx is like a chef not knowing what a spice is, and not allowing Rexx is like a restaurant not allowing food.) |
 |
|
| Back to top |
|
 |
sivafdms Intermediate
Joined: 29 May 2007 Posts: 165 Topics: 77
|
Posted: Mon Oct 29, 2007 8:05 am Post subject: |
|
|
semigeezer,
Can u please provide the rexx code... i just started to work on REXX..
I would be very thankful if u provide the code..
Thanks,
Siva |
|
| Back to top |
|
 |
vkphani Intermediate

Joined: 05 Sep 2003 Posts: 483 Topics: 48
|
|
| Back to top |
|
 |
expat Intermediate

Joined: 01 Mar 2007 Posts: 475 Topics: 9 Location: Welsh Wales
|
Posted: Mon Oct 29, 2007 12:39 pm Post subject: |
|
|
What about ISPF statistics ? _________________ If it's true that we are here to help others,
then what exactly are the others here for ? |
|
| Back to top |
|
 |
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Mon Oct 29, 2007 4:06 pm Post subject: |
|
|
ISPF statistics are sort of an 'honor' system. They are kept in the PDS directory but can be updated at any time to contain anything. It is really a 'user field' that ISPF co-opted decades ago.
Basic code using ISPF services (very little error checking): | Code: | /* Rexx - Count lines in a PDS - argument is fully qualified PDS name*/
Parse Upper Arg pdsname .
Address ispexec
"CONTROL ERRORS CANCEL"
"LMINIT DATAID(D) DATASET('"|| pdsname|| "') ENQ(SHR)"
If rc > 0 Then Do; Say zerrlm ; Return; End
"LMOPEN DATAID(&D) OPTION(INPUT)"
If rc > 0 Then Do; Say zerrlm ; Return; End
mem = ""
total = 0
members = 0
"LMMLIST DATAID(&D) OPTION(LIST) MEMBER(MEM) STATS(NO)"
Do While rc = 0
members = members + 1
"LMMFIND DATAID(&D) MEMBER(&MEM) STATS(NO)"
Do While rc=0
"LMGET DATAID(&D) DATALOC(X) MODE(INVAR) DATALEN(DL) MAXLEN(32760)"
If rc=0 Then
total=total+1
End
"LMMLIST DATAID(&D) OPTION(LIST) MEMBER(MEM) STATS(NO)"
End
"LMFREE DATAID(&D)"
Say "'"||pdsname||": "|| total|| " lines, "|| members|| " members."
Return |
Same can be done w/o ISPF using LISTDS and EXECIO in roughly the same amount of code. _________________ New members are encouraged to read the How To Ask Questions The Smart Way FAQ at http://www.catb.org/~esr/faqs/smart-questions.html. |
|
| Back to top |
|
 |
acevedo Beginner

Joined: 03 Dec 2002 Posts: 127 Topics: 0 Location: Europe
|
Posted: Tue Oct 30, 2007 2:32 am Post subject: |
|
|
| semigeezer wrote: | | Please, people. Not every solution to a mainframe question involves a SORT product. ... when you can write a few lines of Rexx or even CLIST and just read each member and keep a count? Surely the desire to avoid writing a tiny utility program can't be that strong. (And please don't say "but I don't know Rexx" or "Rexx isn't allowed in my shop". A mainframe professional not knowing some basic Rexx is like a chef not knowing what a spice is, and not allowing Rexx is like a restaurant not allowing food.) |
YES!
I remember that times when I was not allowed to run Rexx programs in Production...I remember saying something like semigeezer stated to Production/System guys. |
|
| Back to top |
|
 |
|
|
|