75 pts.
 display all recrods that start with A
I have a file field using which i need to filter the records to be displayed.In the screen i have a 2 byte field for this filtration Example: if i enter R* , it should load all records that start with 'R'.Can anyone please let me know the most feasible logic that works...Its a high priority requirement so please suggest me solutions at an earliest oppurtunity .Thank you



Software/Hardware used:
AS400 - OS400 - RPGLE
ASKED: Jan 12, 2012  3:22 AM GMT
UPDATED: February 28, 2012  11:54:46 AM GMT
3,355 pts.

Answer Wiki:
I think, You should be talking about a subfile, which will have a position to, where you will need to enter the starting character(R*).
You can use the SETLL indicator to point the File to the required position. In this case, to point to the records, which will start with 'R'. From there, you can use your normal Read Operations for displaying the records which will start with 'R'.

If you didnt mean this exactly, Post back here, with your requirement.

Pradeep.
Last Wiki Answer Submitted:  Jan 12, 2012  9:13 AM (GMT)  by  Deepu9321   3,355 pts.
To see other answers submitted to the Answer Wiki View Answer History.
Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _




 

Yes i need to display this in a subfile , Please let me know the logic behind it ? do u mean i need to setll teh file with value as R? will it fetch the records starting with R?

 75 pts.

 

…to setll teh file with value as R? will it fetch the records starting with R?

First, a value such as ‘R*’ would normally mean only records that started with ‘R’. That’s not quite the same as positioning to ‘R’ and reading records from that point on.

Records after ‘R’ would also include records that started with ‘S’ and ‘T’ and all later records. But ‘R*’ would mean that you stop reading as soon as you reached the first record that was after any ‘R’ record.

So, how do you really want your input field to work? If one user enters ‘R*’ and another user enters ‘R ‘, do you want your program to handle those differently?

Tom

 66,925 pts.

 

Hi Tom, as i told is a 2 byte field, user can either enter ‘R*’ or ‘RV’.

In case of ‘RV’ i will have corresponding field in the file to directly key with and load alll records that have key field FLTYPE value as ‘RV’.

In case of ‘R*’ it should load only records that start with ‘R’(i.e all the records which has the FLTYPE = values that start with R,Like RV,RS,RP,RJ etc. )

Ideally my input field should filter the records based on the value given in the 2 byte screen field.

 75 pts.

 

At the same time it should exclude the next set of records that start with character other than ‘R’.

 75 pts.

 

If subst(fieldIn,2,1) = ‘*’;
StrPos = subst(fieldIn,1,1);
EndPos = subst(fieldIn,1,1) + ‘Z’;<– endinb position is the first char + a high value
else; //Case where fieldin is used for start and end
StrPos = fieldin;
EndPos = fieldin;
endif;

Setll StrPos MyFile;
then you are ready to read records and load your subfile .. until Keyfld > EndPos;
Phil

 36,420 pts.