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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Write out NODUPS but just from one file Jay Villaverde DFSORT/ICETOOL 8 Fri Jul 14, 2017 12:44 am
No new posts How to add header with Date(YYMMDD) i... Rajan Moorthy DFSORT/ICETOOL 2 Thu Jul 06, 2017 11:44 pm
No new posts How to generate a new unique Input fi... for1ranjith CLIST & REXX 11 Sat Jul 01, 2017 12:09 pm
No new posts Writing a file using online program grvtomar PL/I & Assembler 3 Fri Jun 30, 2017 1:06 pm


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