Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Formatting a variable length record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Formatting a variable length record
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

Site Director


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

PostPosted: Mon Jan 19, 2009 9:43 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Mon Jan 19, 2009 10:13 am    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Jan 20, 2009 1:24 am    Post subject: Reply to: Formatting a variable length record
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Converting Variable block file to Fix... bhavana yalavarthi DFSORT/ICETOOL 10 Tue May 16, 2017 2:20 pm
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Getting error while opening a variabl... apandey1 COBOL Programming 5 Fri May 05, 2017 12:22 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Length of Tape file Mohan Kothakota JCL & VSAM 9 Thu Apr 20, 2017 10:24 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us