To display record count



IBM's Command List programming language & Restructured Extended Executor

To display record count

Postby samurai007 » Sun Nov 15, 2009 7:32 pm

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.
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: To display record count

Postby dick scherrer » Sun Nov 15, 2009 11:12 pm

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: To display record count

Postby MrSpock » Mon Nov 16, 2009 2:59 am

Make RECCNT an ISPF Edit Macro.
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: To display record count

Postby samurai007 » Mon Nov 16, 2009 10:13 am

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.
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: To display record count

Postby expat » Mon Nov 16, 2009 2:50 pm

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.
expat
 
Posts: 459
Joined: Sat Jun 09, 2007 3:21 pm
Has thanked: 0 time
Been thanked: 8 times

Re: To display record count

Postby samurai007 » Mon Nov 16, 2009 3:08 pm

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.
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time

Re: To display record count

Postby MrSpock » Mon Nov 16, 2009 7:55 pm

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.
User avatar
MrSpock
Global moderator
 
Posts: 809
Joined: Wed Jun 06, 2007 9:37 pm
Location: Raleigh NC USA
Has thanked: 0 time
Been thanked: 4 times

Re: To display record count

Postby samurai007 » Tue Nov 17, 2009 7:20 pm

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.
samurai007
 
Posts: 22
Joined: Mon Jul 20, 2009 10:42 pm
Has thanked: 0 time
Been thanked: 0 time


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post