Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
 
					
				
		
 suryaa30
		
			suryaa30
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Need some help in loading this file format.
I have a file which is space delimited but there are blank values as well.
Load
CompleteRecord,
RecordNo,
Replace(Replace(CompleteRecord,'KER DAY','KERDAY'),chr(32),'$') as DollarRecord;
//////////////////////////////////////////
LOAD
"@1:n" as CompleteRecord,
RecNo() as RecordNo
FROM [lib://Balancing/Mainframe\Archive\Load test.txt]
(fix, codepage is 28591, embedded labels);
After replacing blanks with Dollar. I need to replce multiple '$' with single dollar. The problem comes when if I have blank values.
If Count of '$' < 10 then replace with 1 '$'
If Count of '$' >10 then replace with 2 '$'
so that the blank value is accommodated.
Map1:
Mapping load *
Inline [
x,y
$$,$
$$$,$
$$$$,$
$$$$$,$
$$$$$$,$
$$$$$$$,$
$$$$$$$$,$
$$$$$$$$$,$
$$$$$$$$$$,$
$$$$$$$$$$$,$
];
Load *,
MapSubString('Map1',DollarRecord) as DollarRecord;
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I am not sure if there is a better way to do this... unless the spaces are always the same on each of the row... for example they are always 10 or 20. In that case you can use Replace function....
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		What exactly are you hoping should happen? I am confused as to what are you looking to get at?
 
					
				
		
 olivierrobin
		
			olivierrobin
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		hello
why don't you use a fixed length format ?
you fil seems to contain well aligned columns
that would be easier
using something like that :
LOAD [@1:31],
[@32:45],
[@46:58],
[@59:71],
[@72:80],
[@81:93],
[@94:101],
[@102:n]
FROM
(fix, codepage is 1252, no labels);
 
					
				
		
 suryaa30
		
			suryaa30
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I want to replace the '$' with either single or double based on the count.
if count of '$$$$$$$.......' is greater than 10 then replce with '$$'
if count of '$$$$$$$.......' is less than 10 then replace with '$$'
 
					
				
		
 suryaa30
		
			suryaa30
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I want to replace the '$' with either single or double based on the count.
if count of '$$$$$$$.......' is greater than 10 then replce with '$$'
if count of '$$$$$$$.......' is less than 10 then replace with '$$'
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Isn't that exactly what your script is doing?
 
					
				
		
 suryaa30
		
			suryaa30
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I wanted to see if there is any other standard way instead of using mapsubstring.
 sunny_talwar
		
			sunny_talwar
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		I am not sure if there is a better way to do this... unless the spaces are always the same on each of the row... for example they are always 10 or 20. In that case you can use Replace function....
 
					
				
		
 suryaa30
		
			suryaa30
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		Thanks. the spaces are not the fixed and the count can vary. I will settle with mapsubstring
 
					
				
		
 suryaa30
		
			suryaa30
		
		
		
		
		
		
		
		
	
			
		
		
			
					
		hi thanks for the response. This is just a sample file.
