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
 

 

Help needed in preparing a summary file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Fri Dec 03, 2010 11:32 am    Post subject: Help needed in preparing a summary file
Reply with quote

Dear Friends,

I need to prepare a summary file. Can you please let me know whether this can be achieved using sort?

My input file is 14 byts FB. It has data as follows:
First 3 bytes: File Identification Pic x(3)
Next 6 bytes: Date in MMYYYY
Next 5 bytes: Customer ID Pic 9(5)

Code:
00108201000001
00108201000002
001082009bbbbb   <- b represents spaces
001bbbbbb00002
00108200800001
001bbbbbb00002
00208201000001
002bbbbbb00002
002082009bbbbb
002bbbbbb00002
00208200800001
00208200800002


My output file should look like
column name, count filled (non-blanks),distinct count of each type

eg:
Code:
FILEID,00012,00002,DATE,00008,00003,CUSTID,00010,00002


Can you please help me here?

Regards
Tanden[/code]
Back to top
View user's profile Send private message

Skolusu

Senior Member


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

PostPosted: Sat Dec 04, 2010 12:58 am    Post subject:
Reply with quote

notonly4u,

Your summary report is on 3 different fields which cannot be accomplished in a single pass. However you can concatenate the same file 3 times and get the desired results.

The following DFSORT JCL will give you the desired results
Code:

//STEP0100 EXEC PGM=SORT                                   
//SYSOUT   DD SYSOUT=*                                     
//SORTIN   DD *                                           
//SORTOUT  DD DSN=&&HDR,DISP=(,PASS),SPACE=(TRK,(1,0),RLSE)
//SYSIN    DD *                                           
  SORT FIELDS=COPY                                         
  OUTFIL REMOVECC,BUILD=(14X),HEADER1=(3'$')               
//*                                                       
//STEP0200 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT             
//         DD DSN=Your input FB-14 file,DISP=SHR
//         DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT             
//         DD DSN=Your input FB-14 file,DISP=SHR
//         DD DSN=&&HDR,DISP=SHR,VOL=REF=*.STEP0100.SORTOUT             
//         DD DSN=Your input FB-14 file,DISP=SHR
//SORTOUT  DD SYSOUT=*                                                 
//SYSIN    DD *                                                         
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,3,CH,EQ,C'$$$'),PUSH=(15:ID=1)),   
  IFTHEN=(WHEN=INIT,OVERLAY=(22:C'00001')),                             
  IFTHEN=(WHEN=(15,1,CH,EQ,C'1'),OVERLAY=(16:01,3)),                   
  IFTHEN=(WHEN=(15,1,CH,EQ,C'2'),OVERLAY=(16:04,6)),                   
  IFTHEN=(WHEN=(15,1,CH,EQ,C'3'),OVERLAY=(16:10,5))                     
                                                                       
  SORT FIELDS=(15,7,CH,A)
  SUM FIELDS=(22,5,ZD)                                                 
                                                                       
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(27:13C'0')),                       
  IFTHEN=(WHEN=(15,1,CH,EQ,C'1'),OVERLAY=(37:C'1')),                   
  IFTHEN=(WHEN=(15,1,CH,EQ,C'2'),OVERLAY=(27:22,5,22:5C'0',38:C'1')),   
  IFTHEN=(WHEN=(15,1,CH,EQ,C'3'),OVERLAY=(32:22,5,22:5C'0',39:C'1'))   
                                                                       
  OUTFIL OMIT=(1,3,CH,EQ,C'$$$'),BUILD=(80X),REMOVECC,NODETAIL,         
  TRAILER1=('FIELD,',                                                   
            TOT=(22,5,ZD,M11,LENGTH=5),',',TOT=(37,1,ZD,M11,LENGTH=5), 
            ',DATE,',                                                   
            TOT=(27,5,ZD,M11,LENGTH=5),',',TOT=(38,1,ZD,M11,LENGTH=5), 
            ',CUSTID,',                                                 
            TOT=(32,5,ZD,M11,LENGTH=5),',',TOT=(39,1,ZD,M11,LENGTH=5)) 
//*


The output of this job is a 80 byte file with the following contents
Code:

FIELD,00012,00002,DATE,00008,00003,CUSTID,00010,00002
Back to top
View user's profile Send private message
notonly4u

New User


Joined: 26 Apr 2005
Posts: 87
Location: Hyderabad

PostPosted: Mon Dec 06, 2010 9:13 am    Post subject:
Reply with quote

Dear Kolusu,

Thank you very much for your time and reply.
The answer was verymuch useful.

Regards
Tanden
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 SORTJOIN - Copy Matched and Unmatched... Steve Ironmonger DFSORT/ICETOOL 5 Tue Jan 17, 2017 4:26 pm
No new posts Copy RECFM =VB TO FB file with RECL =... sahil41352 DFSORT/ICETOOL 3 Wed Dec 28, 2016 11:29 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm


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