Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Split 1 file into 10 output Files - S... Prasanth Kumar SYNCSORT 5 Sat Sep 16, 2017 12:02 am
No new posts BUILD OUTFIL based on condition other... balaji81_k DFSORT/ICETOOL 13 Fri Sep 08, 2017 11:06 pm
No new posts Skip file from delete pema_yozer All Other Mainframe Topics 3 Tue Aug 29, 2017 3:19 pm
No new posts editting the file by inserting zeros ... pramodrsingh DFSORT/ICETOOL 9 Mon Aug 21, 2017 5:58 pm
No new posts Match two files using multiple keys a... santoshks1987 SYNCSORT 11 Fri Aug 18, 2017 10:50 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us