View previous topic :: View next topic
Author
Message
anandbtech01 New User Joined: 07 Feb 2022Posts: 15 Location: INDIA
Hi All, I have below need VB file with set of records. The duplicate set need to removed and written in separate file
Attached format Input File and Expected output file
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1348 Location: Bamberg, Germany
Attachments will not be read , use the Code Button instead that works as a toggle. Provide Input and desired Output this way.
Back to top
anandbtech01 New User Joined: 07 Feb 2022Posts: 15 Location: INDIA
Code:
INUPT FILE:
Ø DEALER 1235 XXXXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXXX
Ø ORDER XXXXXXXXXXXXXXXXXXXXX
Ø DEALER 1235 XXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXXX
Ø ORDER XXXXXXXXXXXXXXXXXXXXX
Ø DEALER 1236 XXXXXXXXXXXXXX
Ø DEALER 1234 XXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXX
Ø ORDER XXXXXXXXXXXXXXXXXXXXX
Ø SALES XXXXXXXXXXXXXXXXXXXXX
Ø STOCK XXXXXXXXXXXXXXXXXXXXX
Ø SALESPER XXXXXXX XXXXXXXXXX
Ø DEALER 9999 XXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXXX
Code:
Expected OP :
Ø DEALER 1234 XXXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXXXXXX
Ø ORDER XXXXXXXXXXXXXXXXXXXXXXXXX
Ø SALES XXXXXXXXXXXXXXXXXXXXXXXXX
Ø STOCK XXXXXXXXXXXXXXXXXXXXXXXXX
Ø SALESPER XXXXXXX XXXXXXXXXX
Ø DEALER 1235 XXXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXXXXXXX
Ø ORDER XXXXXXXXXXXXXXXXXXXXXXXXX
Ø DEALER 1236 XXXXXXXXXXXXXXX
Ø DEALER 9999 XXXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXXXXXXX
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1348 Location: Bamberg, Germany
Well, show what you have tried so far. Also let us know the sort criteria you have applied.
Back to top
anandbtech01 New User Joined: 07 Feb 2022Posts: 15 Location: INDIA
I Tried
Code:
OPTION COPY
OUTREC IFTHEN=(WHEN=GROUP,BEGIN=(11,6,CH,EQ,C'DEALER'),
END=(11,5,CH,EQ,C'ORDER'),
PUSH=(80:ID=2))
OUTFIL INCLUDE=(80,2,CH,NE,C' '),BUILD=(1,80)
Code:
INREC IFTHEN=(WHEN=INIT,
OVERLAY=(31:SEQNUM,2,ZD,RESTART=(1,3)))
SORT FIELDS=(1,3,CH,A,31,2,CH,D)
OUTREC IFOUTLEN=32,
IFTHEN=(WHEN=INIT,
OVERLAY=(21:SEQNUM,2,ZD,RESTART=(1,3),
33:SEQNUM,2,ZD,RESTART=(1,3))),
IFTHEN=(WHEN=GROUP,
BEGIN=(33,2,ZD,EQ,1),PUSH=(31:31,2))
I am bit confused , Since the END of each set is different. Whether its possible, I tried some more stupid options as well.
Please help at least with some hint.
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1348 Location: Bamberg, Germany
Code:
//WHATEVER EXEC PGM=ICEMAN
//SORTIN DD *
Ø DEALER 1235 XXXXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXXX
Ø ORDER XXXXXXXXXXXXXXXXXXXXX
Ø DEALER 1235 XXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXXX
Ø ORDER XXXXXXXXXXXXXXXXXXXXX
Ø DEALER 1235 XXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXXX
Ø ORDER XXXXXXXXXXXXXXXXXXXXX
Ø DEALER 1236 XXXXXXXXXXXXXX
Ø DEALER 1234 XXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXX
Ø ORDER XXXXXXXXXXXXXXXXXXXXX
Ø SALES XXXXXXXXXXXXXXXXXXXXX
Ø STOCK XXXXXXXXXXXXXXXXXXXXX
Ø SALESPER XXXXXXX XXXXXXXXXX
Ø DEALER 9999 XXXXXXXXXXXXXX
Ø MODEL XXXXXXXXXXXXXXXXXXXXX
/*
//SYSOUT DD SYSOUT=*
//SORTOUT DD SYSOUT=*
//DUPL DD SYSOUT=*
//SYSIN DD *
OPTION EQUALS
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(7,6,CH,EQ,C'DEALER'),PUSH=(60:36,9,ID=4,SEQ=4))
SORT FIELDS=(60,9,BI,A,69,8,ZD,A)
OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(77:SEQNUM,4,ZD,RESTART=(60,4)))
OUTFIL FNAMES=(SORTOUT),
OMIT=(73,4,ZD,LT,77,4,ZD),
REMOVECC,
BUILD=(1,59)
OUTFIL FNAMES=(DUPL),
REMOVECC,SAVE,
BUILD=(1,59)
END
/*
Output:
Code:
****** **************************** Datenanfang *********************
000001 Ø DEALER 1234 XXXXXXXXXXXXXX
000002 Ø MODEL XXXXXXXXXXXXXXXXXXXX
000003 Ø ORDER XXXXXXXXXXXXXXXXXXXXX
000004 Ø SALES XXXXXXXXXXXXXXXXXXXXX
000005 Ø STOCK XXXXXXXXXXXXXXXXXXXXX
000006 Ø SALESPER XXXXXXX XXXXXXXXXX
000007 Ø DEALER 1235 XXXXXXXXXXXXXX
000008 Ø MODEL XXXXXXXXXXXXXXXXXXXXX
000009 Ø ORDER XXXXXXXXXXXXXXXXXXXXX
000010 Ø DEALER 1236 XXXXXXXXXXXXXX
000011 Ø DEALER 9999 XXXXXXXXXXXXXX
000012 Ø MODEL XXXXXXXXXXXXXXXXXXXXX
****** **************************** Datenende ***********************
Back to top
anandbtech01 New User Joined: 07 Feb 2022Posts: 15 Location: INDIA
Legendry action !!!
Great help !!! I am interested to learn more with SORT in detail, If possible please help to share links, docs that can explain in detail
Back to top
Joerg.Findeisen Senior Member Joined: 15 Aug 2015Posts: 1348 Location: Bamberg, Germany
The best you can do is to follow the DFSORT and SYNCSORT topics in this forum. All you need besides this is the DFSORT Application Guide and some time to try things yourself.
PS: The OPTION EQUALS statement is not needed. It's a leftover from my testing.
Back to top
anandbtech01 New User Joined: 07 Feb 2022Posts: 15 Location: INDIA
Sure, will do that.. Thanks again
Back to top
Rohit Umarjikar Global Moderator Joined: 21 Sep 2010Posts: 3077 Location: NYC,USA
Back to top
anandbtech01 New User Joined: 07 Feb 2022Posts: 15 Location: INDIA
Thanks Rohit
Back to top
Please enable JavaScript!