Joined: 26 Dec 2007 Posts: 18 Location: Chennai, India
Hi,
The space in the subject line was not enough for me to give the short description of the problem. I am sorry for that.
We are facing some problem with an ICETOOL job and in need of some help.
We have a requirement which goes like this.
We have an input VB file with maximum length suppose 500.
The record format in the file is
<First Fixed field having length of 100><Variable field of X length><Second Fixed field having length of 50> (X can be any thing from 1 - 350)
Now according to my requirement we have to copy the data from this input VB file to an output VB file having a maximum length of 400.
If the actual total record length is more than 400 then truncation is fine from the variable length field. But the fixed length fields should be retained as it is.
There are some key values which denote the start of the fixed fields.
For example: in the beginning of the <Second Fixed field having length of 50> we will have a value “HEADER: ” which will be same for all the records. The rest of the field value will differ but finally the length of the fixed field will be same (i.e. : 50).
The problems we are facing are:
Primary Problem:
How to find the position of the first character of <Second Fixed field having length of 50>?
Secondary problem:
If we can find the starting position of <Second Fixed field having length of 50>, we were thinking that we can put the first fixed field, then the variable field’s first 250 characters and then the second fixed field. But we are clueless what to do if the length of the <Variable field of X length> is less than 250. In that case some part of the second fixed field may get included in that 250 characters.
Can any one help us out on this? It is possible that the approach we have taken is not correct. All ideas are welcomed.
I am reconsidering usage of SQZ though as for me it is sqeezing the spaces present any where with in the actual value.
I am trying to trim only the trailing spaces from %01(which may come if the actual length of %01 is <250). Any existing spaces in the middle of %01 is expected to be retained as it is. This is just to make sure that the spaces which are added by the parse function is removed (file system space constraint)
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
sourav_dasgupta,
use the following control cards which will give you the desired results. Since you wanted the preserve the spaces in between we left justify the variable string and then enclose the variable string in double quotes and the last field in double quotes and then use SQZ function to trim the trailing spaces in the variable field.
We also use the new FINDREP function of DFSORT to find and remove the double quotes we added. For complete details on FINDREP, see:
Use [URL] BBCode for External Links