IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

COBOL record question


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
omprakash.mf

New User


Joined: 06 Jul 2010
Posts: 12
Location: hyderabad

PostPosted: Wed Mar 09, 2011 10:38 pm
Reply with quote

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
View user's profile Send private message
daveporcelan

Active Member


Joined: 01 Dec 2006
Posts: 792
Location: Pennsylvania

PostPosted: Wed Mar 09, 2011 10:48 pm
Reply with quote

I recognize this...

It is the hijack and piggyback maneuver
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8697
Location: Dubuque, Iowa, USA

PostPosted: Wed Mar 09, 2011 11:14 pm
Reply with quote

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
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Mar 10, 2011 12:36 am
Reply with quote

I am not even sure if the beginner's section would be the appropriate place for this qustion.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Thu Mar 10, 2011 1:59 am
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
Search our Forums:

Back to Top