View previous topic :: View next topic
|
Author |
Message |
omprakash.mf
New User
Joined: 06 Jul 2010 Posts: 12 Location: hyderabad
|
|
|
|
Hi,
I have data in a file in the below format which does not have any specific record length. And I dont know the record length.
xx yyyyyy
xx yyyyyy
xx yyyyyyyy
spaces are present between xx and yyyyyyy
Need to logic in cobol to write the output in the below format:
xxyyyyyy
xxyyyyyy
xxyyyyyy
Could anyone pls let me know the exact logic in cobol. |
|
Back to top |
|
|
daveporcelan
Active Member
Joined: 01 Dec 2006 Posts: 792 Location: Pennsylvania
|
|
|
|
I recognize this...
It is the hijack and piggyback maneuver |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8697 Location: Dubuque, Iowa, USA
|
|
|
|
Do not post irrelevant questions to the end of a topic -- that's why you start new ones. I've split yours off.
You need to spend some time reading the COBOL manuals (link at the top of the page). If you do this reading, you will find that it is not possible in COBOL to access a file unless you know the record length. This is an absolute. Since you do not know the record length, what you want to do cannot be done. If you had a record length, you could read the entire record into a varaible and split it based on the space (using UNSTRING or reference modification or arrays). |
|
Back to top |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
I am not even sure if the beginner's section would be the appropriate place for this qustion. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Quote: |
I have data in a file in the below format which does not have any specific record length. |
I suspect not. . .
For the file you are reading i'll bet that every record does have a specific length. . .
What created this file?
Once you take out the blank(s) what length should be used for the output data. The space-removed data is to be written into a file is it not? |
|
Back to top |
|
|
|