IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Reject group of records


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
zh_lad

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Mon Oct 11, 2010 9:21 pm
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

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Mon Oct 11, 2010 10:45 pm
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 Developer


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

PostPosted: Mon Oct 11, 2010 11:17 pm
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

Active User


Joined: 06 Jun 2009
Posts: 115
Location: UK

PostPosted: Tue Oct 12, 2010 6:27 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Compare only first records of the fil... SYNCSORT 7
No new posts Pulling a fixed number of records fro... DB2 2
No new posts Join multiple records using splice DFSORT/ICETOOL 5
No new posts EZT program to build a flat file with... All Other Mainframe Topics 9
No new posts JCL sortcard to print only the records DFSORT/ICETOOL 11
Search our Forums:

Back to Top