View previous topic :: View next topic
|
Author |
Message |
hsk
New User
Joined: 28 Nov 2006 Posts: 69 Location: India
|
|
|
|
Two questions ..........
1. Want to count number of lines in a file
- Function LINES ... not working (Error Routine not Found)
- How about EXECIO read into STEM) INDATA. ......
INDATA.0 will give me number of lines ... but generally files are large
Is there a better way ??
2. Want to execute this rexx (say CNTLN) from DSLIST.
3.4 displayes the list of datasets. I want user to write CNTLN infront of the file, this rexx shud count lines in file selected by user.
How to achieve this? |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
sort would be a better solution,
the task is just donkey work for the I/O, and REXX is not the best option |
|
Back to top |
|
|
hsk
New User
Joined: 28 Nov 2006 Posts: 69 Location: India
|
|
|
|
Found some solution ....
It's working for me, not sure if it's efficient or not !!!
Code: |
/*REXX*/
ARG ds
CALL MSG "OFF"
PARSE VALUE ? WITH sysreason re
RC = LISTDSI(ds)
IF( sysreason<>? )THEN re = "REASON="sysreason
IF( RC>4 )THEN CALL ABEXIT RC,"LISTDSI ENDED WITH RC="RC re
IF( sysdsorg<>"VS" )THEN CALL ABEXIT RC,sysdsorg "IS NOT SUPPORTED"
"DELETE COUNT.TEMPFILE"
"ALLOC DD(COUNT) DS(COUNT.TEMPFILE) NEW REUSE UNIT(VIO) SP(30)TR",
"LRECL(32760) RECFM(V B S)"
CALL MSG "ON"; CALL OUTTRAP "O."
"PRINT IDS("ds") OFILE(COUNT) CHAR"
pc = RC
CALL OUTTRAP "OFF"; CALL MSG "OFF"
"FREE DD(COUNT)"
"DELETE COUNT.TEMPFILE"
nr = WORD(o.1,WORDS(o.1))
PARSE VALUE "NONE;YES;"nr "Records;Dataset" ds "contains" nr "records.",
WITH zerrhm";"zerralrm";"zerrsm";"zerrlm";"
ADDRESS ISPEXEC "SETMSG MSG(ISRZ002)"
EXIT pc
ABEXIT:
PARSE ARG cc,ms
SAY ms
ABEXIT:
PARSE ARG cc,ms
SAY ms
EXIT cc |
|
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
Back to top |
|
|
hsk
New User
Joined: 28 Nov 2006 Posts: 69 Location: India
|
|
|
|
gr8 !!!
Thanks !!!
I guess for smaller files, the rexx should not be a problem !!!
Actually want to make it quick, it would be good if i am getting count just by typing a command, rather than changing and submitting JCL then going to spool to check the SYSOUT.
For bigger files (like VSAM Master files), sort could be better option !! |
|
Back to top |
|
|
Pedro
Global Moderator
Joined: 01 Sep 2006 Posts: 2547 Location: Silicon Valley
|
|
|
|
> (like VSAM Master files), sort could be better option
Can VSAM files really be sorted??? |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hi Pedro,
Quote: |
Can VSAM files really be sorted??? |
Yes. Both DFSORT and Syncsort support vsam. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
Back to top |
|
|
|