Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 Moving a COMP-3 Variable to a Numeric... ajayachander COBOL Programming 2 Thu Dec 14, 2017 5:46 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Formatting using DFsort Guru Nandu DFSORT/ICETOOL 5 Thu Nov 30, 2017 7:33 am
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Extract Record using range of Data scorp_rahul23 DFSORT/ICETOOL 3 Wed Nov 15, 2017 11:54 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us