UNICOM Products > UNICOM PowerHouse

Powerhouse programming quiz or qtp help


I need help to get the last record in a series. 
Ex:  access inputfile link clm to claim of service_x   (select input here)
Inputfile has 1 record, Service_x will return 3 records where service_nbr is 16 characters.
I need to find the one with the highest sequence number, which is the final 3 characters of that field.
where ### would be 100, 101, 102 etc.  I need to only select the record which contains 102.

You need multiple passes to do this - one to work out what the maximum is, and then a second one to select it.

I wasn't sure whether you meant one record in inputfile per clm, or just one record total. I think the below should work for either. (Note - I haven't tried it)  Written as QTP but could obviously also be done in a 2 pass quiz.

run xyz

request get_maximum
access inputfile link clm to claim of service_x

sort on clm of inputfile

define d'seq char*3 = service_nbr of service_x[14:3]

temp t'max_sequence char*3
item t'max_sequence maximum d'seq reset at clm

subfile max_seq keep at clm include clm, t'max_sequence

request get_record
access *max_seq link clm to claim of service_x

select service_x if t'max_sequence of max_seq eq service_nbr of service_x[14:3]

.... then whatever you need to do with the record


[0] Message Index

Go to full version