MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Insert the total number of records in file

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities
View previous topic :: View next topic  
Author Message
framework1
Beginner


Joined: 18 Jan 2003
Posts: 3
Topics: 1

PostPosted: Thu Jan 30, 2003 10:31 am    Post subject: Insert the total number of records in file Reply with quote

I want to list the total number of records in a file using sort.

Like this:

Code:
record1
record2
record3
record4
TOTAL RECORDS = 4



How can this be done in CA-EASYTRIEVE ?
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Thu Jan 30, 2003 11:20 am    Post subject: Reply with quote

Framework1,

The following easytrieve job will give you the desired results.

Code:

//STEP0100 EXEC PGM=EZTPA00                       
//*                                               
//STEPLIB  DD DSN=EASYTREV.LOADLIB,     
//            DISP=SHR                             
//SYSPRINT DD SYSOUT=*                             
//SYSOUT   DD SYSOUT=*                             
//SYSSNAP  DD SYSOUT=*                             
//SYSUDUMP DD SYSOUT=*                             
//FILEIN   DD DSN=YOUR INPUT FILE,
//            DISP=SHR                             
//FILEOUT  DD DSN=YOUR OUTPUT FILE,         
//            DISP=(NEW,CATLG,DELETE),             
//            UNIT=SYSDA,                           
//            SPACE=(CYL,(X,Y),RLSE),                     
//            DCB=(LRECL=ZZZ,RECFM=FB,BLKSIZE=0)   
//*                                               
//SYSIN    DD *                                   

  FILE FILEIN                                         
                                                     
  FILE FILEOUT FB(0 0)                               
       FILEOUT-REC   01 LRECL A                         
         TRAIL       01 15    A                         
         COUNT       20 08    N 0                       
                                                     
  JOB INPUT FILEIN FINISH DISP-PROC                   
                                                     
      PUT FILEOUT FROM FILEIN                         
                                                     
  DISP-PROC. PROC                                     
     TRAIL  = 'TOTAL RECORDS ='                       
     COUNT  = RECORD-COUNT                           
     PUT FILEOUT                                     
  END-PROC                                           
/*


If you are looking for a sort solution, then the following DFSORT/ICETOOL JCL will give you the desired results.You should have DFSORT PTF UQ99331 (March, 2002) installed for the following jcl to work as REMOVECC is a new feature introduced.

Code:

//STEP0100 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN       DD DSN=YOUR INPUT FILE,
//            DISP=SHR             
//OUT      DD DSN=YOUR OUTPUT FILE,         
//            DISP=(NEW,CATLG,DELETE),             
//            UNIT=SYSDA,                           
//            SPACE=(CYL,(X,Y),RLSE)                     
//TOOLIN   DD    *                                                     
  COPY FROM(IN) USING(CTL1)                                 
//CTL1CNTL DD *                                                       
  OUTFIL FNAMES=OUT,
    REMOVECC,TRAILER1=('TOTAL RECORDS =',COUNT)           
/*   

If you don't have DFSORT PTF UQ99331 installed then the following DFSORT/ICETOOL JCL will give you the desired results.

Code:

//STEP0100 EXEC PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN       DD DSN=YOUR INPUT FILE,
//            DISP=SHR             
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(5,5),RLSE)   
//OUT      DD DSN=YOUR OUTPUT FILE,         
//            DISP=(NEW,CATLG,DELETE),             
//            UNIT=SYSDA,                           
//            SPACE=(CYL,(X,Y),RLSE)                     
//TOOLIN   DD    *                                                     
  COPY FROM(IN) USING(CTL1)                                 
  COPY FROM(T1) TO(OUT) USING(CTL2)                                 
//CTL1CNTL DD *                                                       
* CREATE THE FBA OUTPUT WITH TRAILER                                   
  OUTFIL FNAMES=T1,
     TRAILER1=('TOTAL RECORDS =',COUNT)           
//CTL2CNTL DD *                                                       
* REMOVE THE ACSII CHARACTER FROM THE RECORDS                         
  OUTREC FIELDS=(2,lrecl)                                                 
/*   


Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Jan 30, 2003 11:51 am    Post subject: Reply with quote

Note that DFSORT's COUNT option gives you an 8-byte value with leading zeros suppressed. If you want the count in a different format, you can use DFSORT's COUNT=(edit) option where edit can be an edit mask (M0-M26) or the EDIT=(...) parameter. You can also use LENGTH=n. For example, if you wanted a 5-byte count with leading zeros suppressed, you could use:

Code:

  TRAILER1=('TOTAL RECORDS = ',COUNT=(EDIT=(IIIIT)))


or

Code:

   TRAILER1=('TOTAL RECORDS = ',COUNT=(M10,LENGTH=5))   


For details of DFSORT's M0-M26 edit masks, see:

http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/ICECA109/3.13?DT=20020722140254#TBLOFMASKX
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
framework1
Beginner


Joined: 18 Jan 2003
Posts: 3
Topics: 1

PostPosted: Tue Feb 04, 2003 11:44 pm    Post subject: Reply with quote

Kolusu,
None of your solutions is working.
Giving me abends.

In EZTreive solution , that steplib is not available in my shop.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Tue Feb 04, 2003 11:50 pm    Post subject: Reply with quote

Framework1,

None of my above posted solutions will work if you have SYNCSORT at your shop.
Try this jcl

Code:

//STEP0100 EXEC PGM=SYNCTOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//IN       DD DSN=YOUR INPUT FILE,
//            DISP=SHR             
//T1       DD DSN=&T1,DISP=(,PASS),SPACE=(CYL,(5,5),RLSE)   
//OUT      DD DSN=YOUR OUTPUT FILE,         
//            DISP=(NEW,CATLG,DELETE),             
//            UNIT=SYSDA,                           
//            SPACE=(CYL,(X,Y),RLSE)                     
//TOOLIN   DD    *                                                     
  COPY FROM(IN) USING(CTL1)                                 
  COPY FROM(T1) TO(OUT) USING(CTL2)                                 
//CTL1CNTL DD *                                                       
* CREATE THE FBA OUTPUT WITH TRAILER                                   
  OUTFIL FNAMES=T1,
     TRAILER1=('TOTAL RECORDS =',COUNT)           
//CTL2CNTL DD *                                                       
* REMOVE THE ACSII CHARACTER FROM THE RECORDS                         
  OUTREC FIELDS=(2,lrecl)                                                 
/*   


For easytrieve, you should code your shop easytrev loadlib for the steplib DD . I gave a general loadlib name as an example.

Check out a sample easytrev jcl from your shop and see what the steplib points to and take the DSN name and copy it over in this jcl

Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
framework1
Beginner


Joined: 18 Jan 2003
Posts: 3
Topics: 1

PostPosted: Wed Feb 05, 2003 9:46 am    Post subject: Reply with quote

Kolusu ,
I am getting this message in toolmsg:

COPY FROM(T1) TO(OUT) USING(CTL2)
SYNCSORT CALLED WITH IDENTIFIER "0002"

and this msg. in DFSMSG:
T1 : RECFM=VBA ; LRECL= 134; BLKSIZE= 27998
OUTREC RDW NOT INCLUDED
SYNCSMF CALLED BY SYNCSORT; RC=0000

and job is abending.

Yes I've syncsort at my shop.


And your EZTreive solution is working correctly to some extent but , in the output file , it is inserting Zeros (Sort of low values) after the actual data.
Back to top
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12367
Topics: 75
Location: San Jose

PostPosted: Wed Feb 05, 2003 10:47 am    Post subject: Reply with quote

Framework1,

Since your input file is vb file the report for the count will be created as VBA. In that case change CTL2CNTL to the following.

Code:

 OUTREC FIELDS=(6,80),CONVERT


The easytrieve solution will have binary zeroes at the end after the count because you must have defined the output file to the length of the input file. But your interest is only to find the number of records in the file like this.
Code:

TOTAL RECORDS =    00000021


The total length of this record is only 28 bytes.

So if you create file with a lrecl of 133,so starting from 29 to 133 bytes you will have binary zeroes.so you either can create a 28 byte file or code a another field in the file declaration to initialize the rest of the bytes.

Code:

FILEOUT-REC     01 133 A                         
        TRAIL   01 15  A                         
        COUNT   20 08  N 0                       
        FILLER  29 105 A

DISP-PROC. PROC                                     
     TRAIL  = 'TOTAL RECORDS ='                       
     COUNT  = RECORD-COUNT
     FILLER = ' '                           
     PUT FILEOUT                                     
  END-PROC                                           



Hope this helps...

cheers

kolusu
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Thu Mar 27, 2003 3:07 pm    Post subject: Reply with quote

Hi..

I am trying the ICEMAN with following.. But I am getting error as 'WER268A OUTFIL STATEMENT : SYNTAX ERROR '

My sysin parameters are as follows :

Code:

 SORT FIELDS=COPY                         
 OUTFIL NODETAIL,OUTREC=(63:X),           
  TRAILER1=('dwc_portfolio_fact_ds_ca,',   
   34:COUNT=(M1,LENGTH=6),',',DATE=(MD4/))


could some one tell me the problem..

Thanks
Anand
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Mar 27, 2003 3:31 pm    Post subject: Reply with quote

Anand,

This works fine with DFSORT which supports COUNT=(M11,LENGTH=6). But Syncsort does NOT support COUNT=(edit).
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Anand_R
Intermediate


Joined: 24 Dec 2002
Posts: 189
Topics: 60

PostPosted: Thu Mar 27, 2003 3:47 pm    Post subject: Reply with quote

Frank,

Can u tell me how can I achieve the same using syncsort.. basically I want the M1 routine. which keeps the zeors in the count as it is.. and I want to remove the carriage control character also..

Thanks
Anand
Back to top
View user's profile Send private message
Frank Yaeger
Sort Forum Moderator
Sort Forum Moderator


Joined: 02 Dec 2002
Posts: 1618
Topics: 31
Location: San Jose

PostPosted: Thu Mar 27, 2003 3:56 pm    Post subject: Reply with quote

Anand,

REMOVECC to remove the carriage control and COUNT=(edit) are both supported by DFSORT, but not Syncsort. I'm the wrong person to ask how to do things with Syncsort since I'm a DFSORT developer (Syncsort is a competitive product). Maybe Kolusu can help you.
_________________
Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Utilities All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group