Page 1 of 1

OMIT Header and Trailor records

PostPosted: Sat Feb 02, 2008 11:25 am
by Satish.bonda
Hi,

I have set of records in a file. Each record has a header and trailor record. I want to omit few records based on one field. At the same time, i want to remove header and trailor record for that record also. Can any one please tell me the solution.

Example:

AAAA12345 --- Header record
Satish99207AAAA --- 99207 record.
Kumar99207AAAA --- one more record.
Sanju99207AAAA --- one more 99207 record
BBBB12345 --- Trailor record
AAAA12346 --- Again Header record
Rajkum56789jklhm --- other than 99207 record
BBBB12346 ---- Trailor record
AAAA12347 --- again header record
Doneku99207 ---- another data record
BBBB12347 --- Trailor record etc;
AAAA12348
kishjk56789
jamhjk56789
BBBB12348

Ques: I want to omit 99207 records including hedear and trailor using sort or any other utility

Expected result:

AAAA12346
Rajkum56789jklhm
BBBB12346
AAAA12348
kishjk56789
jamhjk56789
BBBB12348

Re: OMIT Header and Trailor records

PostPosted: Sat Feb 02, 2008 11:01 pm
by Frank Yaeger
You need to describe the structure of your groups of records more clearly. What identifies a header record ('AAAA' in positions 1-4 or something else)? What identifies the 99207 record -is it just the record after the header record or something else? Does '99207' start at a fixed position in the record (what position?) or can it appear anywhere in the record?

What is the RECFM and LRECL of the input file?