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

Formatting a variable length record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Mon Jan 19, 2009 9:37 am
Reply with quote

Hi,

I have a varaible format file which has data like this...

Sample record:
1;199;391;"2009-01-15";978;63;108;

Now i want the record in the below fashion.
1;199;391;2009-01-15;978;63;108;

I mean the single quotes around the character should be removed. They should not be replaced with any spaces. They just have to be removed.

Please let me know how to do this.

with regards,
Surya
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: Mon Jan 19, 2009 9:43 am
Reply with quote

Hello,

Is the recfm vb or is it really fb with records that happen to have different data positions due to the data content? Please post the fd for the file.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Mon Jan 19, 2009 9:45 am
Reply with quote

dick scherrer wrote:
Hello,

Is the recfm vb or is it really fb with records that happen to have different data positions due to the data content? Please post the fd for the file.



This is teh FD for the file

FD LDG-EXTRACT-FILE-V
LABEL RECORDS ARE STANDARD
RECORDING MODE IS V
BLOCK CONTAINS 0 RECORDS
RECORD IS VARYING IN SIZE
FROM 1 TO 250 CHARACTERS
DEPENDING ON WS-REC-LEN.
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: Mon Jan 19, 2009 10:13 am
Reply with quote

Hello,

Are you reading these records or is this the initial write of these records?

In order to remove the double-quotes (and/or any other characters), create a working-storage 01 that will be the "new" data. Using reference modification, loop thru the data that might contain the unwanted characters, and move each "good" character to the new-data area (yuou would use reference modification on both data areas.

When an unwanted character is found, increment the reference modification positon, add 1 to a "skipped" counter, and do not move the character. When a wanted character is found, move the character and increment both reference modification positions.

Continue thr the loop until ws-rec-len has been reached.

If you are writing new output records, subtract the skipped counter from the original length and write the new record with the unwanted characters removed from the new-data area.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Mon Jan 19, 2009 3:44 pm
Reply with quote

Thanks a lot dick Scherrer.
The above logic worked and is easy compared to
other complex logics i thought

Regards,
Surya
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: Tue Jan 20, 2009 1:24 am
Reply with quote

You're welcome - thanks for the follow-up icon_smile.gif

d
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 Store the data for fixed length COBOL Programming 1
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts PARSE Syntax for not fix length word ... JCL & VSAM 7
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
Search our Forums:

Back to Top