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

split a file in 2 files and count the total of the records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
gabriel.ryoga

New User


Joined: 07 Jun 2007
Posts: 31
Location: Spain

PostPosted: Wed Aug 20, 2008 2:09 pm
Reply with quote

I need to split a file in two files and put the total count of the records in file1 and file2 in a third file:

INPUT:
Code:

AAA
BBB
AAA
AAA
BBB
CCC
BBD


Output1:
Code:

AAA
AAA
AAA


Output2:
Code:

BBB
BBB


Output3:
Code:

5


I just want the records with key AAA or BBB, can I do this in just one job card??.

I know how to do it with two job cards.

Thanks!
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Wed Aug 20, 2008 3:02 pm
Reply with quote

gabriel.ryoga,

What are the LRECL/RECFM of the files? What are the key positions?

Thanks,
Arun
Back to top
View user's profile Send private message
gabriel.ryoga

New User


Joined: 07 Jun 2007
Posts: 31
Location: Spain

PostPosted: Wed Aug 20, 2008 3:36 pm
Reply with quote

Record length = 3, and de key is in position 1,3
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Wed Aug 20, 2008 3:57 pm
Reply with quote

Hi,

try this
Code:
//S1       EXEC PGM=ICEMAN                                         
//SYSOUT   DD SYSOUT=*                                             
//SORTIN   DD *                                                   
AAA                                                               
BBB                                                               
AAA                                                               
AAA                                                               
BBB                                                               
CCC                                                               
BBD                                                               
/*                                                                 
//OUTPUT1 DD SYSOUT=*                                             
//OUTPUT2 DD SYSOUT=*                                             
//OUTPUT3 DD SYSOUT=*                                             
//SYSIN    DD    *                                                 
  SORT FIELDS=COPY                                                 
  INCLUDE COND=(01,3,CH,EQ,C'AAA',OR,                             
                01,3,CH,EQ,C'BBB')                   
  OUTFIL FNAMES=OUTPUT1,INCLUDE=(01,3,CH,EQ,C'AAA'),BUILD=(1,3)   
  OUTFIL FNAMES=OUTPUT2,INCLUDE=(01,3,CH,EQ,C'BBB'),BUILD=(1,3)   
  OUTFIL FNAMES=OUTPUT3,REMOVECC,NODETAIL,
       SECTIONS=(4,01,                     
      TRAILER3=(01:COUNT=(EDIT=(IIT))))   



Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Wed Aug 20, 2008 9:16 pm
Reply with quote

Gerry,

Why would you use SECTIONS and TRAILER3 for the total count instead of just using TRAILER1? Note also, that your job sets the LRECL of OUTPUT3 to 80 (since your input file has LRECL=80) instead of 3. Actually, with an input file with LRECL=3, your job would terminate.

The correct last OUTFIL statement would be:

Code:

  SORT FIELDS=COPY                                                 
  INCLUDE COND=(01,3,CH,EQ,C'AAA',OR,                             
                01,3,CH,EQ,C'BBB')                   
  OUTFIL FNAMES=OUTPUT1,INCLUDE=(01,3,CH,EQ,C'AAA'),BUILD=(1,3)   
  OUTFIL FNAMES=OUTPUT2,INCLUDE=(01,3,CH,EQ,C'BBB'),BUILD=(1,3)   
  OUTFIL FNAMES=OUTPUT3,REMOVECC,NODETAIL,
    BUILD=(1,3),                         
    TRAILER1=(COUNT=(EDIT=(IIT)))         
Back to top
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Thu Aug 21, 2008 3:34 am
Reply with quote

Hi Frank,

my code missed the INREC statement when I cut and pasted it

Code:
  SORT FIELDS=COPY                                                 
  INCLUDE COND=(01,3,CH,EQ,C'AAA',OR,                             
                01,3,CH,EQ,C'BBB')                                 
  INREC  OVERLAY=(4:C'0')                                         
  OUTFIL FNAMES=OUTPUT1,INCLUDE=(01,3,CH,EQ,C'AAA'),BUILD=(1,3)   
  OUTFIL FNAMES=OUTPUT2,INCLUDE=(01,3,CH,EQ,C'BBB'),BUILD=(1,3)   
  OUTFIL FNAMES=OUTPUT3,REMOVECC,NODETAIL,                         
       SECTIONS=(4,01,                                             
      TRAILER3=(01:COUNT=(EDIT=(IIT))))                           



Gerry
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Developer


Joined: 15 Feb 2005
Posts: 7129
Location: San Jose, CA

PostPosted: Thu Aug 21, 2008 4:21 am
Reply with quote

I still don't understand why you think you need to set up a value in position 4 with INREC and use SECTIONS and TRAILER3 when you can just use TRAILER1 without INREC to get the total count more easily as I showed.
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 4
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 To get the count of rows for every 1 ... DB2 3
Search our Forums:

Back to Top