|
View previous topic :: View next topic
|
| Author |
Message |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
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 |
|
 |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
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 |
|
 |
Frank Yaeger
DFSORT Developer

Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
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 |
|
 |
zh_lad
Active User
Joined: 06 Jun 2009 Posts: 115 Location: UK
|
|
|
|
| Thank you very much Frank. Regards. |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|