techslam
New User
Joined: 03 Dec 2010 Posts: 87 Location: India
|
|
|
|
Hi,
I have an input file with LRECL = 80 and FB.
INPUT-FILE-
Code: |
IB1000 MFRM
IB2000 XCD1
IB3000 XCD2
IB4000 XCD3
IB5000 XCD4
IB1000 DNET
IB2000 DCD1
IB3000 DCD2
IB4000 DCD3
IB5000 DCD4
IB1000 CCPP
IB2000 CCD1
IB3000 CCD2
IB4000 CCD3
IB5000 CCD4
IB1000 MFRM
IB2000 YCD1
IB3000 YCD2
IB4000 YCD3
IB5000 YCD4
|
The records are in groups. Starting record of the group can be identified by 'IB1000' at position 1 and length 6. And Ending record of the group can be identified by IB5000 at position 1 and length 6.
Only those groups needs to be written to output files, whose starting record has 'MFRM' at position 8 and length 4.
So the output file(LRECL=80) will have -
Code: |
IB1000 MFRM
IB2000 XCD1
IB3000 XCD2
IB4000 XCD3
IB5000 XCD4
IB1000 MFRM
IB2000 YCD1
IB3000 YCD2
IB4000 YCD3
IB5000 YCD4
|
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
a possible solution could be
Code: |
****** ***************************** Top of Data ******************************
000001 //ENRICO1 JOB NOTIFY=&SYSUID,
000002 // CLASS=A,MSGCLASS=X,MSGLEVEL=(1,1)
000003 //*
000004 //S1 EXEC PGM=SORT
000005 //SYSOUT DD SYSOUT=*
000006 //SORTIN DD *
000007 IB1000 MFRM
000008 IB2000 XCD1
000009 IB3000 XCD2
000010 IB4000 XCD3
000011 IB5000 XCD4
000012 IB1000 DNET
000013 IB2000 DCD1
000014 IB3000 DCD2
000015 IB4000 DCD3
000016 IB5000 DCD4
000017 IB1000 CCPP
000018 IB2000 CCD1
000019 IB3000 CCD2
000020 IB4000 CCD3
000021 IB5000 CCD4
000022 IB1000 MFRM
000023 IB2000 YCD1
000024 IB3000 YCD2
000025 IB4000 YCD3
000026 IB5000 YCD4
000027 //SORTOUT DD SYSOUT=*
000028 //SYSIN DD *
000030 OPTION COPY
000031 INREC IFTHEN=(WHEN=GROUP,
000032 BEGIN=(1,6,CH,EQ,C'IB1000'),
000033 END=(1,6,CH,EQ,C'IB5000'),
000034 PUSH=(81:8,4))
000035 OUTFIL BUILD=(1,80),
000036 INCLUDE=(81,4,CH,EQ,C'MFRM')
****** **************************** Bottom of Data ****************************
|
output
Code: |
********************************* TOP OF DATA **********************************
IB1000 MFRM
IB2000 XCD1
IB3000 XCD2
IB4000 XCD3
IB5000 XCD4
IB1000 MFRM
IB2000 YCD1
IB3000 YCD2
IB4000 YCD3
IB5000 YCD4
******************************** BOTTOM OF DATA ******************************** |
it will discard everything between an IB5000 and the IB1000 that follows
an alternative taking into account only the ib1000 <flag>
considering as a group everything until the next IB1000
could be
Code: |
....
000028 //SYSIN DD *
000029 OPTION COPY
000030 INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,6,CH,EQ,C'IB1000'),PUSH=(81:8,4))
000031 OUTFIL BUILD=(1,80),
000032 INCLUDE=(81,4,CH,EQ,C'MFRM')
****** **************************** Bottom of Data **************************** |
|
|