Posted: Tue Feb 02, 2016 9:47 pm Post subject: String Comparision with multiple condition
I want to write a Sort card to extract record having name field value( last_Name or First_Name) only one or two character, We need to consider Space as well. The requirement i have tried to show in the form of Input and output file
The field Length is 40 and record length 1000(FB)
1) Rahul, Kumar
2) Rahul, A
3) Rajesh,B N
4) Suresh, B Y
5) AM, Tomeu
1) Rahul, A
2) Rajesh,B N
3) Suresh, B Y
4) AM, Tomeu
The fact that you show data which is irregular implies that you have to deal with anything being irregular with your name data.
This would include a comma being missing, and if there is a comma in the data following, that will cause you problems.
So, first use OVERLAY to relocate your 40-byte field to a temporary extension to the record.
Then use PARSE to create two PARSEd fields, with ABSPOS=1001 to look only at your extended data.
Use ENDBEFR=C',' for the first PARSEd field, FIXLEN=40, and use FIXLEN=40 for the second PARSEd field.
Further extend the record to include the two PARSEd fields. Use JFY with SHIFT=LEFT on both fields.
If the second PARSEd field is entirely blank, there is either no comma or no first name. What do you want to do with that?
You can then test the second or third byte of the first PARSEd field for blank. Test the second byte of the second PARSEd field for blank. This can be on INCLUDE= on OUTFIL, then BUILD=(1,1000) to drop off the extensions to the record.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum