|
View previous topic :: View next topic
|
| Author |
Message |
Balaji Canabady
New User
Joined: 07 Dec 2011 Posts: 19 Location: India
|
|
|
|
Hi
My input file(REFM=VB,LRECL=1000) has the following sets of records
| Quote: |
01 header1/
02 header2/
.
.
03 data records(which are of 2 types)
03,111111,.../(which are of 2 types)
16,101,.../
16,102,.../
49,3/
03,222222,.../
16,201,.../
16,202,.../
49,3/
.
.
98 Trailer1/
99 Trailer2/
|
Sample Input Data
| Code: |
01,000000000,000000000,120221,0021,1,01,120221,2/
02,,305100074,1,120220,0021,INR,2,/
03,111111,22117001,INR,015,+0,,Z,045,+0,,Z,100,+0,0,Z,400,+0,0,Z/
49,2/
03,111111,59999999,USD,470/
16,101,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
49,6/
03,111111,59999999,USD,470/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
49,11/
03,222222,48888888,USD,470/
16,201,50000,V,120220,0000/
16,201,50000,V,120220,0000/
16,201,50000,V,120220,0000/
16,201,50000,V,120220,0000/
16,202,50000,V,120220,0000/
16,202,50000,V,120220,0000/
16,202,50000,V,120220,0000/
16,202,50000,V,120220,0000/
49,11/
03,222222,48888888,USD,470/
16,201,50000,V,120220,0000/
16,202,50000,V,120220,0000/
49,8/
98/
99,37/
|
My requirement is to have headers, trailers and only the data records starting with '03,111111' having occurences of '16,101' and '16,102' records greater than 3 times.
Sample Output Data
| Code: |
01,000000000,000000000,120221,0021,1,01,120221,2/
02,,305100074,1,120220,0021,INR,2,/
03,111111,59999999,USD,470/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,101,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
16,102,50000,V,120220,0000/
49,11/
98/
99,15/
|
The following control card of mine copies the data records starting with '03,111111. But how do I modify it to include only data records having occurences of '16,101' and '16,102' more than 3 times.
| Code: |
//TOOLIN DD *
COPY FROM(INP) TO(OUT) USING(CTL1)
//CTL1CNTL DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,6:5)),
IFTHEN=(WHEN=GROUP,
BEGIN=(9,6,CH,EQ,C'111111'),
END=(6,3,CH,EQ,C'49,'),
PUSH=(5:ID=1))
OUTFIL FNAMES=OUT,
INCLUDE=(5,1,CH,NE,C' ',OR,
6,2,CH,EQ,C'01',OR,
6,2,CH,EQ,C'02',OR,
6,2,CH,EQ,C'98',OR,
6,2,CH,EQ,C'99'),
BUILD=(1,4,5:6)
|
|
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Balaji Canabady,
Use the following DFSORT JCL which will give you the desired results.
| Code: |
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//INA DD DSN=Your input VB file,DISP=SHR
//INB DD DSN=Same input VB file again,DISP=SHR
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
JOINKEYS F1=INA,FIELDS=(5,8,A),SORTED,NOSEQCK
JOINKEYS F2=INB,FIELDS=(5,8,A)
JOIN UNPAIRED
REFORMAT FIELDS=(F1:1,4,F2:5,16,F1:21)
INREC IFTHEN=(WHEN=GROUP,PUSH=(5:24,6),
BEGIN=(21,2,CH,EQ,C'03'),END=(21,2,CH,EQ,C'49'))
OUTFIL BUILD=(1,4,21),
INCLUDE=(21,2,SS,EQ,C'01,02,98,99',OR,
(05,6,CH,EQ,C'111111',AND,13,4,ZD,GT,3,AND,17,4,ZD,GT,3))
//*
//JNF1CNTL DD *
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,ZD,START=0,8X,5)),
IFTHEN=(WHEN=GROUP,PUSH=(5:ID=8),
BEGIN=(21,2,CH,EQ,C'03'),END=(21,2,CH,EQ,C'49'))
//*
//JNF2CNTL DD *
OPTION EQUALS
INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,ZD,START=0,8C'0',5)),
IFTHEN=(WHEN=GROUP,PUSH=(5:ID=8),
BEGIN=(21,2,CH,EQ,C'03'),END=(21,2,CH,EQ,C'49')),
IFTHEN=(WHEN=(21,6,CH,EQ,C'16,101'),OVERLAY=(16:C'1')),
IFTHEN=(WHEN=(21,6,CH,EQ,C'16,102'),OVERLAY=(20:C'1'))
SUM FIELDS=(13,4,ZD,17,4,ZD)
//* |
|
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|