Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Reject group of records

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
zh_lad

New User


Joined: 06 Jun 2009
Posts: 95
Location: UK

PostPosted: Mon Oct 11, 2010 9:21 pm    Post subject: Reject group of records
Reply with quote

Hi,

LRECL = 500
Account number, P=1, L=36

It has got group of records per account. Header followed by detail records, however, no trailer. Header is always the first record.

Header record P=43, L=2, Value = CU
Details records have got values TX, MX, DR, EX, IA, PF or DR etc on P=43, L=2

I would like to reject those group of records which havn't got any DR record.

Input
701647330050000000016338341900000025 CU100000000001500300002 0
701647330050000000016338341900000025 IA400000000021500300002GBP0035
701647330050000000016338341900000025 LC8000000000000001CASH LIMIT 2
701647330050000000016338341900000025 MX800000000010002GBP0000001001
701647330050000000016338341900000025 MC800000000091002GBP0000009002
701647330050000000016338341900000025 CL11000000000100000005202VAL
701647330050000000016338341900000025 EX200000000000002GBP 030000000
701647330050000000016338341900000025 TX300000000004002GBPPU04000000
701647350050000000026338341901103521 CU100000000001500300001 0
701647350050000000026338341901103521 MX800000000270001GBP0000027020
701647350050000000026338341901103521 MC800000000341001GBP0000034002
701647350050000000026338341901103521 CL11000000000100000735705COLIN
701647350050000000026338341901103521 IA400000000020500300001GBP0034
701647350050000000026338341901103521 LC8000000000000001CASH LIMIT 2
701647350050000000026338341901103521 DR110000000002UK36
701647350050000000026338341901103521 EX200000000000001GBP 030000000
701647350050000000026338341901103521 TX300000000008001GBPPU04000000
701647350050000000026338341901103521 IA400000000010500300001GBP0010

Output
Good records
701647350050000000026338341901103521 CU100000000001500300001 0
701647350050000000026338341901103521 MX800000000270001GBP0000027020
701647350050000000026338341901103521 MC800000000341001GBP0000034002
701647350050000000026338341901103521 CL11000000000100000735705COLIN
701647350050000000026338341901103521 IA400000000020500300001GBP0034
701647350050000000026338341901103521 LC8000000000000001CASH LIMIT 2
701647350050000000026338341901103521 DR110000000002UK36
701647350050000000026338341901103521 EX200000000000001GBP 030000000
701647350050000000026338341901103521 TX300000000008001GBPPU04000000
701647350050000000026338341901103521 IA400000000010500300001GBP0010

Reject records (rejected becuase it hasn't got a DR record in group)
701647330050000000016338341900000025 CU100000000001500300002 0
701647330050000000016338341900000025 IA400000000021500300002GBP0035
701647330050000000016338341900000025 LC8000000000000001CASH LIMIT 2
701647330050000000016338341900000025 MX800000000010002GBP0000001001
701647330050000000016338341900000025 MC800000000091002GBP0000009002
701647330050000000016338341900000025 CL11000000000100000005202VAL
701647330050000000016338341900000025 EX200000000000002GBP 030000000
701647330050000000016338341900000025 TX300000000004002GBPPU04000000

Thanks,
zh_lad
Back to top
View user's profile Send private message

zh_lad

New User


Joined: 06 Jun 2009
Posts: 95
Location: UK

PostPosted: Mon Oct 11, 2010 10:45 pm    Post subject:
Reply with quote

The DR record has only one occurrence in a group. Based on this and using file matching technique (NONDUPS etc), I have created a file only consisting those headers (CU record type) which haven't got any DR. It is possible to omit group of these headers from main file.

Many thanks.
Back to top
View user's profile Send private message
Frank Yaeger

DFSORT Moderator


Joined: 15 Feb 2005
Posts: 7130
Location: San Jose, CA

PostPosted: Mon Oct 11, 2010 11:17 pm    Post subject:
Reply with quote

Here's a DFSORT/ICETOOL job that will do what you asked for using just the original input file.

Code:

//S1    EXEC  PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG  DD SYSOUT=*
//IN DD DSN=...  input file (FB/500)
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(CYL,(5,5)),DISP=(,PASS)
//OUT1 DD DSN=...  output file1 (FB/500)
//OUT2 DD DSN=...  output file2 (FB/500)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY JKFROM USING(CTL2)
/*
//CTL1CNTL DD *
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(43,2,CH,EQ,C'CU'),PUSH=(501:ID=8))
  OUTFIL FNAMES=T1,INCLUDE=(43,2,CH,EQ,C'DR')
/*
//JNF2CNTL DD *
  INREC IFTHEN=(WHEN=GROUP,BEGIN=(43,2,CH,EQ,C'CU'),PUSH=(501:ID=8))
/*
//CTL2CNTL DD *
  JOINKEYS F1=T1,FIELDS=(501,8,A),SORTED,NOSEQCK
  JOINKEYS F2=IN,FIELDS=(501,8,A),SORTED,NOSEQCK
  JOIN UNPAIRED,F2
  REFORMAT FIELDS=(F2:1,500,?)
  OUTFIL FNAMES=OUT1,INCLUDE=(501,1,CH,EQ,C'B'),BUILD=(1,500)
  OUTFIL FNAMES=OUT2,INCLUDE=(501,1,CH,EQ,C'2'),BUILD=(1,500)
/*
Back to top
View user's profile Send private message
zh_lad

New User


Joined: 06 Jun 2009
Posts: 95
Location: UK

PostPosted: Tue Oct 12, 2010 6:27 pm    Post subject:
Reply with quote

Thank you very much Frank. Regards.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syncsort Help to group fields sudhakarraju SYNCSORT 6 Thu Dec 29, 2016 1:38 am
No new posts Removing Duplicates based on certain ... chandracdac DFSORT/ICETOOL 8 Fri Dec 09, 2016 4:40 am
No new posts Limit duplicate records in the SORT pshongal SYNCSORT 6 Mon Nov 21, 2016 12:54 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us