IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Count of records in a file by reading a FTP script


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Mon May 25, 2009 3:34 pm
Reply with quote

I have an FTP script file (Format- FB, LRECL - 80) which will have format as mentioned below,

FTP SCRIPT file content:

put MF file name1 ' Non-MF file name1'
put MF file name2 ' Non-MF file name2'
put MF file name3 ' Non-MF file name3'
put MF file name4 ' Non-MF file name4'


Each MF file is VB file with LRECL different.

Now I need a create a job to read each MF file and count the number of records in each file and write a TRAILER3 record with "Non-MF file name:" <Corresponding MF rec count>.

My O/P should look like this:

Non-MF file name1: 1200000
Non-MF file name2: 1234
Non-MF file name3: 83642
Non-MF file name4: 3215


Sam.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Wed May 27, 2009 4:19 am
Reply with quote

samuel_Inba,

The following DFSORT JCL will give you the desired results. This job will generate a dynamic JCL which will be submitted via intrdr which in turn will create the report

Verify the output from step0200 and if you see the JCL is generated correctly replace the following statement in step0200
Code:

//SORTOUT  DD SYSOUT=*                       

with
Code:

//SORTOUT  DD SYSOUT=(*,INTRDR)               

Code:

//STEP0100 EXEC PGM=SORT                                         
//SYSOUT   DD SYSOUT=*                                           
//SORTIN   DD *                                                 
PUT MF FILE NAME1 ' NON-MF FILE NAME1'                           
PUT MF FILE NAME2 ' NON-MF FILE NAME2'                           
PUT MF FILE NAME3 ' NON-MF FILE NAME3'                           
PUT MF FILE NAME4 ' NON-MF FILE NAME4'                           
//TOOL     DD DSN=&&T,DISP=(,PASS),SPACE=(CYL,(5,5,),RLSE)       
//INDD     DD DSN=&&I,DISP=(,PASS),SPACE=(CYL,(5,5,),RLSE)       
//CTLDD    DD DSN=&&C,DISP=(,PASS),SPACE=(CYL,(5,5,),RLSE)       
//SYSIN    DD *                                                 
  SORT FIELDS=COPY                                               
  INREC PARSE=(%00=(STARTAFT=C'PUT',ENDBEFR=X'7D',FIXLEN=080),   
               %01=(ENDBEFR=X'7D',FIXLEN=080)),                 
  BUILD=(%00,JFY=(LEAD=C'DISP=SHR,DSN=',SHIFT=LEFT),%01)         
                                                                 
  OUTFIL FNAMES=TOOL,REMOVECC,                                   
  BUILD=(C' COPY FROM(INP',SEQNUM,3,ZD,                         
         C') TO(OUT) USING(C',SEQNUM,3,ZD,C')',80:X),           
  TRAILER1=(C'/*',80:X)                                         
                                                                 
  OUTFIL FNAMES=INDD,                                           
  BUILD=(C'//INP',SEQNUM,3,ZD,3X,C'DD ',1,54,80:X)               
                                                                 
  OUTFIL FNAMES=CTLDD,REMOVECC,                                 
  BUILD=(C'//C',SEQNUM,3,ZD,C'CNTL DD *',/,                     
         C'  OUTFIL FNAMES=OUT,VTOF,NODETAIL,BUILD=(80:X),',/,   
         C'  TRAILER1=(''',81,44,C' : ''',C',COUNT)',80:X),     
  TRAILER1=(C'/*',80:X)                                         
/*                                                               
//STEP0200 EXEC  PGM=SORT                     
//SYSOUT   DD SYSOUT=*                       
//SYSIN    DD *                               
   SORT FIELDS=COPY                           
/*                                           
//SORTOUT  DD SYSOUT=*                       
//SORTIN   DD DATA,DLM=$$                     
//TIDXXXXA JOB 'COPY',                       
//             CLASS=A,                       
//             MSGCLASS=Y,                   
//             MSGLEVEL=(1,1),               
//             NOTIFY=TID                     
//*                                           
//STEP0100 EXEC  PGM=ICETOOL                 
//TOOLMSG  DD SYSOUT=*                       
//DFSMSG   DD SYSOUT=*                       
//OUT      DD DSN=OUTPUT COUNT OF ALL DSN,   
//            DISP=(MOD,CATLG,DELETE),       
//            UNIT=SYSDA,                     
//            SPACE=(CYL,(X,Y),RLSE)         
//TOOLIN   DD *                               
$$                                           
//         DD DSN=&T,DISP=(OLD,PASS)         
//         DD DSN=&C,DISP=(OLD,PASS)         
//         DD DSN=&I,DISP=(OLD,PASS)         


The output from step0200 will be something like this

Code:

//TIDXXXXA JOB 'COPY',                                                 
//             CLASS=A,                                               
//             MSGCLASS=Y,                                             
//             MSGLEVEL=(1,1),                                         
//             NOTIFY=TID                                             
//*                                                                   
//STEP0100 EXEC  PGM=ICETOOL                                           
//TOOLMSG  DD SYSOUT=*                                                 
//DFSMSG   DD SYSOUT=*                                                 
//OUT      DD DSN=OUTPUT COUNT OF ALL DSN,                             
//            DISP=(MOD,CATLG,DELETE),                                 
//            UNIT=SYSDA,                                             
//            SPACE=(CYL,(X,Y),RLSE)                                   
//TOOLIN   DD *                                                       
 COPY FROM(INP001) TO(OUT) USING(C001)                                 
 COPY FROM(INP002) TO(OUT) USING(C002)                                 
 COPY FROM(INP003) TO(OUT) USING(C003)                                 
 COPY FROM(INP004) TO(OUT) USING(C004)                                 
/*                                                                     
//C001CNTL DD *                                                       
  OUTFIL FNAMES=OUT,VTOF,NODETAIL,BUILD=(80:X),                       
  TRAILER1=(' NON-MF FILE NAME1                           : ',COUNT)   
//C002CNTL DD *                                                       
  OUTFIL FNAMES=OUT,VTOF,NODETAIL,BUILD=(80:X),                       
  TRAILER1=(' NON-MF FILE NAME2                           : ',COUNT)   
//C003CNTL DD *                                                       
  OUTFIL FNAMES=OUT,VTOF,NODETAIL,BUILD=(80:X),                       
  TRAILER1=(' NON-MF FILE NAME3                           : ',COUNT)   
//C004CNTL DD *                                                       
  OUTFIL FNAMES=OUT,VTOF,NODETAIL,BUILD=(80:X),                       
  TRAILER1=(' NON-MF FILE NAME4                           : ',COUNT)   
/*                                                                     
//INP001   DD DISP=SHR,DSN=MF FILE NAME1                               
//INP002   DD DISP=SHR,DSN=MF FILE NAME2                               
//INP003   DD DISP=SHR,DSN=MF FILE NAME3                               
//INP004   DD DISP=SHR,DSN=MF FILE NAME4                               
Back to top
View user's profile Send private message
samuel_Inba

New User


Joined: 03 Jan 2008
Posts: 53
Location: Chennai

PostPosted: Fri May 29, 2009 12:41 pm
Reply with quote

Thanks a lot Skolusu ...

I got a error msg:

ICE224A ddname CANNOT BE USED FOR A REPORT - RECFM WITHOUT 'A'
SPECIFIED, OR VSAM DATA SET

There was one keyword which i added in the dynamically build cntrl card ... REMOVECC in the to remove the ASA carriage cntrl character.

The JCL was awesome and i was able to implement it sucessfully...

Thanks icon_smile.gif ....


-Sam.
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Fri May 29, 2009 10:12 pm
Reply with quote

samuel_Inba,

Oops I forgot the carriage control character removal. I am glad that you figured out yourself.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top