Page 1 of 1

To display record count

PostPosted: Sun Nov 15, 2009 7:32 pm
by samurai007
Hi,

I am relatively new to REXX and i could use some help here. :?

I have a requirement for a REXX tool to calculate and display the number of records in a given PS file.
I have a REXX code, where I give the input DSN name, calculate the record count and write it to an output PS file.

However, is it possible to do something like this...

Assume the DSN name of the REXX code which does the above processing is - SYS01.SYSLIB.SOURCE.REXXLIB(RECCNT)
Now, i open the target PS file, whose record count i want to calculate, and just type RECCNT on the command line.
And, the count should be displayed on the ISPF screen itself. I dont want it written on an output file.

Is this possible :?: If so, how :?:

Thanks,
Sam.

Re: To display record count

PostPosted: Sun Nov 15, 2009 11:12 pm
by dick scherrer
Hello,

Suggest you do not use rexx for this - rexx is probably the worst possible tool to use to pass volumes of data. . .

You might consider using the sort product that is on the system.

Most organizations do not find any value in running processes to count records. If a record count was needed, it is incorporated into the processes that create or read the data - not some standalone process.

Re: To display record count

PostPosted: Mon Nov 16, 2009 2:59 am
by MrSpock
Make RECCNT an ISPF Edit Macro.

Re: To display record count

PostPosted: Mon Nov 16, 2009 10:13 am
by samurai007
Hi Dick..

Thanks for your suggestions.
I know Sort is good when it comes to handling huge volumes of data.
But is it possible to "Display" the record count rather than writing it to an output file ?


Hi MrSpock..

Could you tell me how to make it an ISPF Edit Macro ?

Thanks,
Sam.

Re: To display record count

PostPosted: Mon Nov 16, 2009 2:50 pm
by expat
Whoa back...............

Take a long look at what Dick has suggested. REXX is one of the worst possible options for volume data processing. You might be happy to sit there while your terminal is locked as it counts records, but why waste time and resource when it can be done more efficiently.

Re: To display record count

PostPosted: Mon Nov 16, 2009 3:08 pm
by samurai007
Hi Expat...

Take a long look at what Dick has suggested


I know Sort is good when it comes to handling huge volumes of data.


I did acknowledge that we have more efficient ways of doing it rather than Rexx.
But my question was how to do that ??

If you know how it can be done, please share it.

Thanks,
Sam.

Re: To display record count

PostPosted: Mon Nov 16, 2009 7:55 pm
by MrSpock
samurai007 wrote:Could you tell me how to make it an ISPF Edit Macro ?


1. You need to determine what library or libraries are used at your site for user-written ISPF Edit macros. If you want to write your macro in REXX or CLIST, then the library(ies) need(s) to be allocated to your SYSPROC or SYSEXEC DD's for your TSO session.

2. One you know #1, then create the member RECCNT in that library.

3. Presuming you want to code your macro in REXX, you need the /*REXX*/ statement first. Next, to identify the code as an ISPF Edit macro, you need the "ISREDIT MACRO" statement.

4. I presume that, as a user of ISPF that you're familiar with the concept of the Editor-assigned labels like .zfirst, .zlast, etc:

1.3.6.1 Editor-Assigned Labels

Since .zlast contains the line number of the last data line, then all you need to do is get and display its value:

"ISREDIT (last) = LINENUM .zlast"

3.3.48 LINENUM--Query the Line Number of a Labeled Line.

zedsmsg = 'Count:'Strip(last,L,'0')' Lines'
zedlmsg = 'Count:'Strip(last,L,'0')' Lines'
"ISPEXEC SETMSG MSG(ISRZ001)"

2.2.3.8 Edit Macro Messages.

Re: To display record count

PostPosted: Tue Nov 17, 2009 7:20 pm
by samurai007
Hi Mr.Spock..

It worked brilliantly.. Thanks..

But i think it doesnt work when we open the file in 'Browse' mode.. or in other words.. with larger files.. as dick had suggested earlier...

For that, i think we would have to settle with Sort or something else.

Thanks again..
Sam.