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 How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts SQZ pipe delimited file with 1 column... Rick Silvers DFSORT/ICETOOL 2 Sun Nov 06, 2016 8:11 pm
No new posts Joinkeys operation when key1 and key2... Susanta DFSORT/ICETOOL 5 Wed Nov 02, 2016 5:35 pm
No new posts sort with previous record anatol DFSORT/ICETOOL 9 Thu Oct 06, 2016 2:36 am
No new posts Get Record count in summary record fo... Atul Banke DFSORT/ICETOOL 21 Fri Sep 23, 2016 4:17 pm


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