Hi All,
This is my input file and my requirement is to exclude the group that starts with <Request> and ends with </Request> having Event=Payment.
Input is FB file of LRECL : 400
<Report>
<Requests>
<Request RequestID="5803727242796658404053">
<BillTo>
<CustomerID/>
</BillTo>
<PaymentMethod>
<TypeDescription>Checking</TypeDescription>
</PaymentMethod>
<Events>
<Event>Stop Payment</Event>
<EventDate>2020-01-31T16:00:00Z</EventDate>
</Events>
</Request>
<Request RequestID="5803727242796658404053">
<BillTo>
<CustomerID/>
</BillTo>
<PaymentMethod>
<TypeDescription>Checking</TypeDescription>
</PaymentMethod>
<Events>
<Event>Payment</Event>
<EventDate>2020-01-31T16:00:00Z</EventDate>
</Events>
</Request>
</Requests>
</Report>
I tried the following sort card
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,BEGIN=(1,9,CH,EQ,C'<Request '),
RECORDS=31,PUSH=(401:ID=1)),
IFTHEN=(WHEN=GROUP,BEGIN=(8,7,CH,EQ,C'Payment'),
RECORDS=13,PUSH=(403:SEQ=1)),
IFTHEN=(WHEN=NONE,OVERLAY=(401:C'1'))
OUTFIL INCLUDE=(401,1,CH,NE,C' ',AND,403,1,CH,EQ,C' '),
BUILD(1,400)
This sort card is removing only the group that starts with Payment in the second xml , but I want to remove the entire XML starting from <Request> if that has Payment in Event tag.
I have been breaking my head on this for the past 3 days and I tried several things, but nothing helped . Can someone please look into this and guide me on how to remove the 2nd set of XML start from <Request>to </Request> as it has <Event> = Payment.