View previous topic :: View next topic
Author
Message
gabriel.ryoga New User Joined: 07 Jun 2007Posts: 31 Location: Spain
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:
Output2:
Output3:
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
Arun Raj Moderator Joined: 17 Oct 2006Posts: 2481 Location: @my desk
gabriel.ryoga,
What are the LRECL/RECFM of the files? What are the key positions?
Thanks,
Arun
Back to top
gabriel.ryoga New User Joined: 07 Jun 2007Posts: 31 Location: Spain
Record length = 3, and de key is in position 1,3
Back to top
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
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
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
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
gcicchet Senior Member Joined: 28 Jul 2006Posts: 1702 Location: Australia
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
Frank Yaeger DFSORT Developer Joined: 15 Feb 2005Posts: 7129 Location: San Jose, CA
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
Please enable JavaScript!