I have a requirement wherein I have to extract some records based on a condition from a file. The file is having multi line records, that is records spanned accross multiple lines. The data in the file is secure so I am mocking up the data in the input file.
Input file will look like follows:
Code:
----+----1----+----2----+----3----+----4----+
BANK1 HBANK1 NAME
DBI <<DETAIL RECORD 1 >>
1C ADDITIONAL DETAIL 1 RECORD 1
2C ADDITIONAL DETAIL 2 RECORD 1
C 1234562222222222 000
DBI <<DETAIL RECORD 2 >>
1C ADDITIONAL DETAIL 1 RECORD 2
2C ADDITIONAL DETAIL 2 RECORD 2
C 3456761111111111 000
90000002
BANK2 HBANK2 NAME
DBI <<DETAIL RECORD 1 >>
1C ADDITIONAL DETAIL 1 RECORD 1
C 9876543333333333 000
DBI <<DETAIL RECORD 2 >>
1C ADDITIONAL DETAIL 1 RECORD 2
C 9876542222222222 000
DBI <<DETAIL RECORD 3 >>
1C ADDITIONAL DETAIL 1 RECORD 3
2C ADDITIONAL DETAIL 2 RECORD 3
C 9876542222222222 000
90000003
There is no key in every line (row) which can identify that how many lines(row) belong to each record. The only way to know this is that a record starts with a detail record followed by multiple lines of additional record and ending in the card line(row). Details records are clubbed between a header and a trailer record with the counts of total records present in the trailer record.
Example of one complete record for a card with various details is as follows:
Code:
DBI <<DETAIL RECORD 3 >>
1C ADDITIONAL DETAIL 1 RECORD 3
2C ADDITIONAL DETAIL 2 RECORD 3
C 9876542222222222 000
The input file represents 2 records for BANK1 and 3 records for BANK2. This is prominent from the trailer records in both the batch(BANK1 and BANK2).
The column number 9 will identify each record. For example:
H --> Header record [ having details of Bank1 and Bank2 ]
D --> Detail record [Detail of the card]
1,2,3,4,5 --> Additional detail of record. [This is optional record and may or may not be present for a detail record]
C--> This represents the secure data e.g.card number.
Secure data can be like a card number and my requirement is to extract records for which the first 6 bytes of a card number is say '123456'.
Card number will start at column 11.
That way the output should be as follows:
Code:
----+----1----+----2----+----3----+----4-
BANK1 HBANK1 NAME
DBI <<DETAIL RECORD 1 >>
1C ADDITIONAL DETAIL 1 RECORD 1
2C ADDITIONAL DETAIL 2 RECORD 1
C 1234562222222222 000
90000001
The output records should have a header (same as the header from which the record is extracted) and a trailer with the number of records updated.
The LRECL of both the input and output file is 800 and RECFM=FB.
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Aditya.Srivastava,
I guess there are much simpler ways to get the desired results. what is the LRECL and RECFM of the input file? And do you dynamically change the condition to extract? Is it just one credit number you want to extract or more than 1? if so are they in a separate file?
The LRECL and RECFM of the input file will be 800 and FB respectively.
The condition will not be dynamic. We know all the list of identification numbers (the first 6 digit of the credit number). We can have the list stored in an 80 byte parm but we will always have a fixed list before the process runs in production. This list will not change frequently.