View previous topic :: View next topic |
Author |
Message |
suryavenkat_sharma Beginner
Joined: 06 Jul 2004 Posts: 3 Topics: 2
|
Posted: Tue Jul 06, 2004 8:50 am Post subject: How to find the size of a file using jcl? |
|
|
In my job i have one input file and i need to know how many bytes this file has occupied. This size i need to write into the output file. Can any one please help me? |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Jul 06, 2004 9:31 am Post subject: |
|
|
suryavenkat_sharma,
The simple method of calculating the filesize is
Code: |
FILESIZE in BYTES = ((TOTAL NO: OF RECORDS) * LRECL )
|
Let us say your file LRECL is 80 bytes and it has a total of 100 records then the
Code: |
FILESIZE in BYTES = (100 * 80 ) = 8,000 BYTES
|
This method is only effective when there is NO compression involved.
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
superk Advanced
Joined: 19 Dec 2002 Posts: 684 Topics: 5
|
Posted: Tue Jul 06, 2004 9:35 am Post subject: |
|
|
Determining the byte count of a dataset might be tricky, unless you want to write your own program (compute number of records X the length of each record). I'm looking to see if there is any existing STANDARD utility that returns a byte count (it will probably be something that runs under USS). No luck yet. |
|
Back to top |
|
|
suryavenkat_sharma Beginner
Joined: 06 Jul 2004 Posts: 3 Topics: 2
|
Posted: Tue Jul 06, 2004 10:07 am Post subject: Thank you. |
|
|
Thank you Kolusu. I tried this and i got it now. Thanks superk.
Thanks,
Surya Venkat sharma. |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
|
Posted: Tue Jul 06, 2004 10:10 am Post subject: |
|
|
suryavenkat_sharma,
If you have easytrieve at your shop then the following JCl will give you the desired results.
Code: |
//STEP0100 EXEC PGM=EZTPA00
//STEPLIB DD DSN=EASYTREV.LOADLIB,
// DISP=SHR
//SYSPRINT DD SYSOUT=*
//FILEIN DD DSN=YOUR INPUT FILE,
// DISP=SHR
//SYSIN DD *
FILE FILEIN
W-FILE-SIZE W 09 N 0
JOB INPUT(FILEIN) FINISH DISP-PROC
DISP-PROC. PROC
W-FILE-SIZE = FILEIN:RECORD-LENGTH * FILEIN:RECORD-COUNT
DISPLAY 'FILESIZE IN BYTES:' W-FILE-SIZE
END-PROC
/*
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue Jul 06, 2004 12:06 pm Post subject: |
|
|
Kolusu,
Isn't the 'file size as a product of number of records and LRECL' true for FB datasets? In case of VB, the sum of RDW for all records should give the file size. _________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Jul 06, 2004 12:16 pm Post subject: |
|
|
No. Not that either. For both FB and especially VB, there can be extra bytes on disk either in unused blocks, or unused tracks. So finding out how 'how many bytes this file has occupied' is not the same thing as finding out how many bytes you would read if you read the file one byte at a time. I'm not sure how to do it, but I think you'd have to find the various DSCBs, calculate the number of tracks and the track size and then do the multiplication (of course, it is worse if the data set spans unlike volumes). One of the utilities might provide enough information for that (IEHLIST?) but I haven't checked. Normally this would be done in assembler using various macros (OBTAIN, etc). Although there is rarely much use for this information, it always amazed me that there is no single command to find it. |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Jul 06, 2004 12:21 pm Post subject: |
|
|
Actually, on 2nd thought, it is worse than that. Not only do we now have compressed files, but most DASD these days is simulated in RAID devices, striped data sets, and other virtual DASD mechanisms. So reliably finding the real physical amount that a data set occupies is probably impossible. The best you can probably do is to find the amount that MVS *thinks* it is occupying (per my last post). |
|
Back to top |
|
|
Cogito-Ergo-Sum Advanced
Joined: 15 Dec 2002 Posts: 637 Topics: 43 Location: Bengaluru, INDIA
|
Posted: Tue Jul 06, 2004 12:30 pm Post subject: |
|
|
Quote: | For both FB and especially VB, there can be extra bytes on disk either in unused blocks, or unused tracks. |
This will also hold for a tape dataset too ? (I think, you have reminded me (again) the difference between a physical record.)
BTW, would the SYSUSED variable set by LISTDSI in REXX tell us about the actual space used? I do not think so. My test reports negative.
Quote: | Although there is rarely much use for this information, it always amazed me that there is no single command to find it. |
I think, you answered it...
Quote: | Although there is rarely much use for this information... |
_________________ ALL opinions are welcome.
Debugging tip:
When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.
-- Sherlock Holmes. |
|
Back to top |
|
|
semigeezer Supermod
Joined: 03 Jan 2003 Posts: 1014 Topics: 13 Location: Atlantis
|
Posted: Tue Jul 06, 2004 12:35 pm Post subject: |
|
|
I think 'rarely' is changing though. MVS systems are interacting with other systems more frequently now than before. For example, MVS systems participate in storage area networks (SANs), can use NFS, use (non-standard) FTP, and expose the file systems in other ways. It would be nice if, for example, FTP listings could show calculated sizes. I'd have thought that once MVS started playing in the 'client/server' game back in the early 90s the need to show file sizes would have been evident. That is why I'm surprised there is no single command or macro to calculate it. |
|
Back to top |
|
|
|
|