Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search 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
Author Message
gabriel.ryoga

New User


Joined: 07 Jun 2007
Posts: 27
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
References
arcvns

Senior Member


Joined: 17 Oct 2006
Posts: 706
Location: Chennai, India

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: 27
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: 648

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: 4574
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: 648

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: 4574
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1