View previous topic :: View next topic
|
Author |
Message |
harish5002
New User
Joined: 21 Jul 2010 Posts: 23 Location: chennai
|
|
|
|
HI All,
Data is retrived from oracle to flat file by giving the condition where there is a num field it should give 20 bytes space.So in flat file we got as below.Where ever the num field is there we 20 bytes.the file size 600 bytes.But now my requirement is to remove the adiitional sapace and decrease the length of the file.EX:suppose if u check third column we are having 7 bytes of data but remaining 13 bytes as free space.Like this lot of columns are there i need to reduce the empty sapce where 20bytes of space is occupied and i need to write into output file.....
We need to decrease the length of also.in the following we are having 60bytes as lenth if we remove the space it should decrease 26 bytes.
Please help me ASAP....................
Code: |
600000005143011; 84297116842; 3783061;
600000005143012; 84297116842; 3783061;
600000005143013; 84297116859; 3783061;
600000005143014; 84297116859; 3783061;
600000005143015; 84297116859; 3783061;
600000005143016; 84297116859; 3783061;
600000005143017; 84297118105; 3783061;
600000005143017; 84297118105; 3783061;
600000005143018; 84297116859; 3783061;
600000005143019; 84297116088; 3783061;
600000005143020; 84297116088; 3783061;
600000005143020; 84297116088; 3783061;
600000005143021; 84297118105; 3783061;
|
Thanks in advance,
HARISH |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
we do not do asap... we do when and if we feel like
remember,
helping people/replying is
on voluntary basis
on our own time
free of charge
interest of the topic
benevolence factor
claiming urgency will most likely lower dramatically Your benevolence factor!
the fastest way would be anyway to look at the oracle manuals for strip/trim function to be applied at select time !
Quote: |
Data is retrived from oracle to flat file by giving the condition where there is a num field it should give 20 bytes space. |
but if You want to get rid of the extra space why do You enforce a useless condition at select
it would be better, in order not to waste everybody' s time to review the whole requirement and post again when You know for sure what You want to do |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Is the data created "dynamically", can the file change layout change from run-to-run?
If the file layout is fixed, just define two record layouts, one with fillers for the blanks and the other not. Move the fields. Done.
Or not fixed? You might like to let us know. Let us know what you know about the file, hopefully it is more than you have already done. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
Follow on...
if You cannot modify the database interface/queries run a two step process
using sort to squeeze out the useless blanks
after You have told us what sort product and what release You are running
somebody might move the topic to place where it belongs
( searching the dfsort forum with the squeeze keyword will return quite a few hits ) |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Sorry, thought the thread was in the Cobol forum :-) |
|
Back to top |
|
|
harish5002
New User
Joined: 21 Jul 2010 Posts: 23 Location: chennai
|
|
|
|
Sorry,enrico for mentioning ASAP.
Hi Bill Woodger,
We can change the length in single or two steps.....I heard that we can remove the spaces by using sort.if i know particular field length we can otherwise is there any option....Because my file length is 6000.In that file some fields are having 20 bytes some fields will have 18 bytes it varies.If i want to count which field is having 20 bytes manually in the sense it will be very difficult.In that every field is separated by comma as shown above.
Thanks and Regards,
Harish |
|
Back to top |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
Can you, as enrico suggested, change the extract so that the spaces are dropped off before they even get to the file?
Otherwise, due to the size of the file, maybe Cobol would be better? Check out STRING/UNSTRING. Are all the records the same format? If yes, still check as you go along. Do you want to loose the space totally? You'll need to know how long the final record is. No big problem. Do you have text fields in the file as well, which may include blanks or semi-colons (;)? |
|
Back to top |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
Dare I ask why the requirement to remove the spaces.
If it is to save DASD space, then you will spend more money on processing time than you will save on DASD storage costs. |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
I read description of the problem many times but could not make much sense out of it.
Also, if anyhow you achieve what you might be wanting - then, what is next?
Quote: |
We need to decrease the length of also.in the following we are having 60bytes as lenth if we remove the space it should decrease 26 bytes. |
This makes some sense and if this is all what you want - is not using OUTREC parameter of the SORT products would just do what you want. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
|
|
but something that does not make any sense
Quote: |
Data is retrived from oracle to flat file by giving the condition where there is a num field it should give 20 bytes space |
and then the TS asks how to get rid of the unwanted spaces ...
so the bothering question is ...
are the spaces wanted or not? meditate people meditate |
|
Back to top |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6248 Location: Mumbai, India
|
|
|
|
I agree with you Enrico. However, if you work from a vendor site, at times it so happens that IT Service companies work as different blocks of the same application which do not talk to each other.
In one of my assignment at other shop, we were involved in creating back-end DB2 Stored procedures whereas the other vendor was working on Front-end part of that application. I remember how tough call it was to convince the other vendor, to send us an indicator telling if they "want to scroll up or down" the "resultnat rows, if they don't fit on single page". ..I hope OP is not dealing with such things...though having initial valus from Oracle DB smells like that. |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10888 Location: italy
|
|
Back to top |
|
|
|