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

Help needed in preparing a summary file


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 1
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
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top