Académique Documents
Professionnel Documents
Culture Documents
135TQAFBCB|saNDy|SCaR
125ALQTA22|fOOTBALL|VOLLEYbAll
125AB**128|CURE|CUTE
126ABCD1 3|LION|TIGER
182BCDFC |LEE|WARNE
126BACD//C|SCION|FORD
128ALPTA*2|AccoRD|acuRA
152ABLTAC1|rAM|
251ACQADF2||dRAMA
182CATF125|A C|SAM
124ADEF^BC|SPUR|DRAB
For this code_textfile, do the following
1. Validate the code using the following rules. If the code is invalid, the whole record
must be loaded into a reject file.
The length of the field must be 10.
If the code has * replace the field with Q
The first 3 characters of the code must be a number and the next 4 fields must
be characters (a-z, A-Z).
If a field has a * and has been relaced with Q in the above first 7 fields, the
code is invalid and if not then the code is valid and should conforms with the
above specification also.
2. Add a new field concats1s2 which concatenates the strings s1 and s2
Ex: string1 =abc and string2 = cde concats1s1 =>abccde
String1 =cde and string2=
concats1s2 =>cde
3. Add a new field conconcats1s2. To populate this field, compare both strings s1 and s2
and if s1>s2 then concats1s2 = > s1s2 and if s1<s2 concats1s2 = > s2s1.
4. Add a field countvowels and populate the field with the count of all the vowels
(a,e,i,o,u or A,E,I,O,U) present in the field concats1s2.
5. Add a new field repvow. To populate this field, replace all the occurances of vowels
(a,e,i,o,u or A,E,I,O,U) with zyxwv respectively i.e replace a =z,e=y,i=x,o=w,u=v
Ex: amnipute => zmnxpvty.
6. Add a field countcode. Populate the field with the number of occurrences of A in
the code column.
7. Add a new field, get_count_code. Populate this field with, get the concatenated value
of the first and second fields of code column delimited by A.
Ex: code = 12ACDFGA12 get_count_code => 12:CDFG
8. Convert the concatss1s2 field into upper case and lowercases and dump them into two
new columns.