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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: split a file in 2 files and count the total of the records
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: 2284
Location: @my desk

PostPosted: Wed Aug 20, 2008 3:02 pm    Post subject:
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    Post subject:
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: 1703
Location: Australia

PostPosted: Wed Aug 20, 2008 3:57 pm    Post subject:
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 Moderator


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

PostPosted: Wed Aug 20, 2008 9:16 pm    Post subject:
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: 1703
Location: Australia

PostPosted: Thu Aug 21, 2008 3:34 am    Post subject:
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 Moderator


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

PostPosted: Thu Aug 21, 2008 4:21 am    Post subject:
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    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 file based on comparsion to 2 f... Div Grad DFSORT/ICETOOL 3 Thu Jul 27, 2017 9:16 pm
No new posts Extra character appears in file when ... Balu5491 All Other Mainframe Topics 1 Wed Jul 26, 2017 2:39 pm
No new posts SSH - known_hosts file configuration vasanthz All Other Mainframe Topics 2 Wed Jul 26, 2017 2:10 am
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


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