Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Count of records in a file by reading a FTP script

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: Count of records in a file by reading a FTP script
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    Post subject: Reply to: Count of records in a file by reading a FTP script
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    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Check if any Detail records and extra... V S Amarendra Reddy SYNCSORT 19 Mon May 08, 2017 8:54 pm
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Issue with NDM process to transmit ES... chetanambi All Other Mainframe Topics 6 Wed May 03, 2017 10:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us