kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12385 Topics: 75 Location: San Jose
|
Posted: Thu Oct 09, 2025 9:17 pm Post subject: Re: Extract group records based on matching file names |
|
|
nbdtrjk_1 wrote: | Every group consists of 4 records, and if a file name matches either FILE1 or FILE2, or FILE4 then I want to write out those group's records to an Output file.
|
nbdtrjk_1,
Can the file1 , file 2 or file4 names appear anywhere in the file name?
ex:
Code: |
abc.file1.def.file3
def.file3.ijk.file4 |
If you are only looking the LAST qualifier as FILE1, FILE2 or FILE4 then the following untested DFSORT control cards will give you the desired results.
Code: | //SYSIN DD *
OPTION COPY
INREC IFTHEN=(WHEN=GROUP,
BEGIN=(019,04,CH,GT,C' '),
PUSH=(081:ID=8,
091:01,80)),
IFTHEN=(WHEN=(019,61,SS,EQ,C' FROM '),
PARSE=(%=(ABSPOS=29,
ENDAT=C' '),
%1=(SUBPOS=9,
FIXLEN=09)),
OVERLAY=(171:%1),HIT=NEXT),
IFTHEN=(WHEN=(019,61,SS,EQ,C' FROM '),
PARSE=(%2=(ABSPOS=171,
STARTAFT=C'.',
FIXLEN=08)),
OVERLAY=(181:%2))
OUTREC IFTHEN=(WHEN=GROUP,
BEGIN=(181,8,CH,GT,C' '),
PUSH=(181:181,08),RECORDS=3)
OUTFIL REMOVECC,BUILD=(01,80),
INCLUDE=(181,08,CH,EQ,C'FILE1',OR,
181,08,CH,EQ,C'FILE2',OR,
181,08,CH,EQ,C'FILE4'),
SECTIONS=(81,8,
HEADER3=(91,80))
/* |
_________________ Kolusu
www.linkedin.com/in/kolusu |
|